2012-04-03 03:34:16 +02:00
|
|
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_BROWSER_MAIN_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_BROWSER_MAIN_H_
|
|
|
|
#pragma once
|
|
|
|
|
2013-02-06 21:41:54 +01:00
|
|
|
#include "libcef/browser/browser_pref_store.h"
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "base/basictypes.h"
|
|
|
|
#include "base/memory/scoped_ptr.h"
|
2013-09-03 18:43:31 +02:00
|
|
|
#include "base/memory/scoped_vector.h"
|
2013-03-07 02:20:24 +01:00
|
|
|
#include "base/prefs/pref_service.h"
|
2013-04-16 00:16:01 +02:00
|
|
|
#include "base/strings/string_piece.h"
|
2013-02-06 21:41:54 +01:00
|
|
|
#include "chrome/browser/net/pref_proxy_config_tracker.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "content/public/browser/browser_main_parts.h"
|
2013-02-06 21:41:54 +01:00
|
|
|
#include "net/proxy/proxy_config_service.h"
|
2013-09-03 18:43:31 +02:00
|
|
|
#include "net/url_request/url_request_context_getter.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
namespace base {
|
2013-04-16 00:16:01 +02:00
|
|
|
class MessageLoop;
|
2012-04-03 03:34:16 +02:00
|
|
|
class Thread;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace content {
|
|
|
|
struct MainFunctionParams;
|
|
|
|
}
|
|
|
|
|
|
|
|
class CefBrowserContext;
|
|
|
|
class CefDevToolsDelegate;
|
|
|
|
|
|
|
|
class CefBrowserMainParts : public content::BrowserMainParts {
|
|
|
|
public:
|
|
|
|
explicit CefBrowserMainParts(const content::MainFunctionParams& parameters);
|
|
|
|
virtual ~CefBrowserMainParts();
|
|
|
|
|
2012-04-11 20:00:55 +02:00
|
|
|
virtual void PreMainMessageLoopStart() OVERRIDE;
|
2013-03-12 21:23:24 +01:00
|
|
|
virtual void PostMainMessageLoopStart() OVERRIDE;
|
2014-05-22 23:01:22 +02:00
|
|
|
virtual void PreEarlyInitialization() OVERRIDE;
|
2013-12-07 02:55:22 +01:00
|
|
|
virtual void ToolkitInitialized() OVERRIDE;
|
2012-04-03 03:34:16 +02:00
|
|
|
virtual int PreCreateThreads() OVERRIDE;
|
|
|
|
virtual void PreMainMessageLoopRun() OVERRIDE;
|
|
|
|
virtual void PostMainMessageLoopRun() OVERRIDE;
|
2012-06-28 19:21:18 +02:00
|
|
|
virtual void PostDestroyThreads() OVERRIDE;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2013-09-03 18:43:31 +02:00
|
|
|
CefBrowserContext* browser_context() const {
|
|
|
|
return global_browser_context_.get();
|
|
|
|
}
|
|
|
|
scoped_refptr<net::URLRequestContextGetter> request_context() const {
|
|
|
|
return global_request_context_;
|
|
|
|
}
|
|
|
|
CefDevToolsDelegate* devtools_delegate() const {
|
|
|
|
return devtools_delegate_.get();
|
|
|
|
}
|
2013-03-07 02:20:24 +01:00
|
|
|
PrefService* pref_service() const { return pref_service_.get(); }
|
2013-02-06 21:41:54 +01:00
|
|
|
scoped_ptr<net::ProxyConfigService> proxy_config_service() {
|
|
|
|
return proxy_config_service_.Pass();
|
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2013-09-03 18:43:31 +02:00
|
|
|
void AddBrowserContext(CefBrowserContext* context);
|
|
|
|
void RemoveBrowserContext(CefBrowserContext* context);
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
private:
|
|
|
|
void PlatformInitialize();
|
|
|
|
void PlatformCleanup();
|
|
|
|
|
2013-09-03 18:43:31 +02:00
|
|
|
scoped_ptr<CefBrowserContext> global_browser_context_;
|
|
|
|
scoped_refptr<net::URLRequestContextGetter> global_request_context_;
|
|
|
|
ScopedVector<CefBrowserContext> browser_contexts_;
|
2013-06-22 04:06:32 +02:00
|
|
|
scoped_ptr<CefDevToolsDelegate> devtools_delegate_;
|
2013-04-16 00:16:01 +02:00
|
|
|
scoped_ptr<base::MessageLoop> message_loop_;
|
2013-02-06 21:41:54 +01:00
|
|
|
scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
|
|
|
|
scoped_ptr<net::ProxyConfigService> proxy_config_service_;
|
2013-03-07 02:20:24 +01:00
|
|
|
scoped_refptr<CefBrowserPrefStore> pref_store_;
|
|
|
|
scoped_ptr<PrefService> pref_service_;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefBrowserMainParts);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_BROWSER_MAIN_H_
|