CEF3: Update to Chromium revision 130586.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@578 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-04-04 18:18:09 +00:00
parent 0b3ef6e2cd
commit f94336aade
17 changed files with 124 additions and 132 deletions

View File

@ -17,5 +17,5 @@
{ {
'chromium_url': 'http://src.chromium.org/svn/trunk/src', 'chromium_url': 'http://src.chromium.org/svn/trunk/src',
'chromium_revision': '128896', 'chromium_revision': '130586',
} }

View File

@ -38,10 +38,13 @@
#ifdef BUILDING_CEF_SHARED #ifdef BUILDING_CEF_SHARED
// Use the existing CrAppProtocol definition. // Use the existing CrAppProtocol definition.
#include "base/message_pump_mac.h" #import "base/message_pump_mac.h"
// Use the existing CrAppControlProtocol definition. // Use the existing CrAppControlProtocol definition.
#include "base/mac/scoped_sending_event.h" #import "base/mac/scoped_sending_event.h"
// Use the existing UnderlayableSurface definition.
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
// Use the existing empty protocol definitions. // Use the existing empty protocol definitions.
#import "base/mac/cocoa_protocols.h" #import "base/mac/cocoa_protocols.h"
@ -51,17 +54,23 @@
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
// Copy of CrAppProtocol definition from base/message_pump_mac.h. // Copy of definition from base/message_pump_mac.h.
@protocol CrAppProtocol @protocol CrAppProtocol
// Must return true if -[NSApplication sendEvent:] is currently on the stack. // Must return true if -[NSApplication sendEvent:] is currently on the stack.
- (BOOL)isHandlingSendEvent; - (BOOL)isHandlingSendEvent;
@end @end
// Copy of CrAppControlProtocol definition from base/mac/scoped_sending_event.h. // Copy of definition from base/mac/scoped_sending_event.h.
@protocol CrAppControlProtocol<CrAppProtocol> @protocol CrAppControlProtocol<CrAppProtocol>
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent; - (void)setHandlingSendEvent:(BOOL)handlingSendEvent;
@end @end
// Copy of definition from ui/base/cocoa/underlay_opengl_hosting_window.h.
@protocol UnderlayableSurface
- (void)underlaySurfaceAdded;
- (void)underlaySurfaceRemoved;
@end
// The Mac OS X 10.6 SDK introduced new protocols used for delegates. These // The Mac OS X 10.6 SDK introduced new protocols used for delegates. These
// protocol defintions were not present in earlier releases of the Mac OS X // protocol defintions were not present in earlier releases of the Mac OS X
// SDK. In order to support building against the new SDK, which requires // SDK. In order to support building against the new SDK, which requires
@ -103,6 +112,11 @@ DEFINE_EMPTY_PROTOCOL(NSWindowDelegate)
@protocol CefAppProtocol<CrAppControlProtocol> @protocol CefAppProtocol<CrAppControlProtocol>
@end @end
// All CEF windows should implement this protocol to be informed explicitly
// about underlay surfaces.
@protocol CefUnderlayableSurface<UnderlayableSurface>
@end
// Controls the state of |isHandlingSendEvent| in the event loop so that it is // Controls the state of |isHandlingSendEvent| in the event loop so that it is
// reset properly. // reset properly.
class CefScopedSendingEvent { class CefScopedSendingEvent {

View File

@ -7,7 +7,6 @@
#include <map> #include <map>
#include "libcef/browser/browser_host_impl.h" #include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/browser_main.h"
#include "libcef/browser/download_manager_delegate.h" #include "libcef/browser/download_manager_delegate.h"
#include "libcef/browser/resource_context.h" #include "libcef/browser/resource_context.h"
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
@ -19,7 +18,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "content/browser/download/download_manager_impl.h" #include "content/public/browser/download_manager.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/geolocation_permission_context.h" #include "content/public/browser/geolocation_permission_context.h"
#include "content/public/browser/speech_recognition_preferences.h" #include "content/public/browser/speech_recognition_preferences.h"
@ -190,9 +189,9 @@ class CefSpeechRecognitionPreferences
} // namespace } // namespace
CefBrowserContext::CefBrowserContext( CefBrowserContext::CefBrowserContext() {
CefBrowserMainParts* main_parts) InitWhileIOAllowed();
: main_parts_(main_parts) {
// Initialize the request context getter. // Initialize the request context getter.
url_request_getter_ = new CefURLRequestContextGetter( url_request_getter_ = new CefURLRequestContextGetter(
GetPath(), GetPath(),
@ -207,10 +206,7 @@ CefBrowserContext::~CefBrowserContext() {
} }
} }
FilePath CefBrowserContext::GetPath() { void CefBrowserContext::InitWhileIOAllowed() {
if (!path_.empty())
return path_;
#if defined(OS_WIN) #if defined(OS_WIN)
CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path_)); CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path_));
path_ = path_.Append(std::wstring(L"cef_data")); path_ = path_.Append(std::wstring(L"cef_data"));
@ -229,7 +225,9 @@ FilePath CefBrowserContext::GetPath() {
if (!file_util::PathExists(path_)) if (!file_util::PathExists(path_))
file_util::CreateDirectory(path_); file_util::CreateDirectory(path_);
}
FilePath CefBrowserContext::GetPath() {
return path_; return path_;
} }
@ -240,8 +238,8 @@ bool CefBrowserContext::IsOffTheRecord() const {
content::DownloadManager* CefBrowserContext::GetDownloadManager() { content::DownloadManager* CefBrowserContext::GetDownloadManager() {
if (!download_manager_.get()) { if (!download_manager_.get()) {
download_manager_delegate_ = new CefDownloadManagerDelegate(); download_manager_delegate_ = new CefDownloadManagerDelegate();
download_manager_ = new DownloadManagerImpl(download_manager_delegate_, download_manager_ =
NULL); content::DownloadManager::Create(download_manager_delegate_, NULL);
download_manager_delegate_->SetDownloadManager(download_manager_.get()); download_manager_delegate_->SetDownloadManager(download_manager_.get());
download_manager_->Init(this); download_manager_->Init(this);
} }

View File

@ -12,22 +12,21 @@
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
class DownloadManager;
namespace content { namespace content {
class DownloadManagerDelegate; class DownloadManagerDelegate;
class ResourceContext; class ResourceContext;
class SpeechRecognitionPreferences; class SpeechRecognitionPreferences;
} }
class CefBrowserMainParts;
class CefDownloadManagerDelegate; class CefDownloadManagerDelegate;
class CefBrowserContext : public content::BrowserContext { class CefBrowserContext : public content::BrowserContext {
public: public:
explicit CefBrowserContext(CefBrowserMainParts* main_parts); CefBrowserContext();
virtual ~CefBrowserContext(); virtual ~CefBrowserContext();
void InitWhileIOAllowed();
// BrowserContext methods. // BrowserContext methods.
virtual FilePath GetPath() OVERRIDE; virtual FilePath GetPath() OVERRIDE;
virtual bool IsOffTheRecord() const OVERRIDE; virtual bool IsOffTheRecord() const OVERRIDE;
@ -56,8 +55,6 @@ class CefBrowserContext : public content::BrowserContext {
scoped_refptr<content::SpeechRecognitionPreferences> scoped_refptr<content::SpeechRecognitionPreferences>
speech_recognition_preferences_; speech_recognition_preferences_;
CefBrowserMainParts* main_parts_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserContext); DISALLOW_COPY_AND_ASSIGN(CefBrowserContext);
}; };

View File

@ -22,6 +22,7 @@
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/resource_request_info_impl.h" #include "content/browser/renderer_host/resource_request_info_impl.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h" #include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_details.h" #include "content/public/browser/notification_details.h"
@ -124,12 +125,12 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::Create(
const CefWindowInfo& window_info, const CefWindowInfo& window_info,
const CefBrowserSettings& settings, const CefBrowserSettings& settings,
CefRefPtr<CefClient> client, CefRefPtr<CefClient> client,
TabContents* tab_contents, content::WebContents* web_contents,
CefWindowHandle opener) { CefWindowHandle opener) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
if (tab_contents == NULL) { if (web_contents == NULL) {
tab_contents = new TabContents( web_contents = content::WebContents::Create(
_Context->browser_context(), _Context->browser_context(),
NULL, NULL,
MSG_ROUTING_NONE, MSG_ROUTING_NONE,
@ -138,7 +139,7 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::Create(
} }
CefRefPtr<CefBrowserHostImpl> browser = CefRefPtr<CefBrowserHostImpl> browser =
new CefBrowserHostImpl(window_info, settings, client, tab_contents, new CefBrowserHostImpl(window_info, settings, client, web_contents,
opener); opener);
if (!browser->PlatformCreateWindow()) if (!browser->PlatformCreateWindow())
return NULL; return NULL;
@ -267,8 +268,8 @@ void CefBrowserHostImpl::SetFocus(bool enable) {
return; return;
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {
if (tab_contents_.get()) if (web_contents_.get())
tab_contents_->Focus(); web_contents_->Focus();
} else { } else {
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::SetFocus, this, enable)); base::Bind(&CefBrowserHostImpl::SetFocus, this, enable));
@ -302,8 +303,8 @@ bool CefBrowserHostImpl::CanGoBack() {
void CefBrowserHostImpl::GoBack() { void CefBrowserHostImpl::GoBack() {
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {
if (tab_contents_.get() && tab_contents_->GetController().CanGoBack()) if (web_contents_.get() && web_contents_->GetController().CanGoBack())
tab_contents_->GetController().GoBack(); web_contents_->GetController().GoBack();
} else { } else {
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::GoBack, this)); base::Bind(&CefBrowserHostImpl::GoBack, this));
@ -317,8 +318,8 @@ bool CefBrowserHostImpl::CanGoForward() {
void CefBrowserHostImpl::GoForward() { void CefBrowserHostImpl::GoForward() {
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {
if (tab_contents_.get() && tab_contents_->GetController().CanGoForward()) if (web_contents_.get() && web_contents_->GetController().CanGoForward())
tab_contents_->GetController().GoForward(); web_contents_->GetController().GoForward();
} else { } else {
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::GoForward, this)); base::Bind(&CefBrowserHostImpl::GoForward, this));
@ -332,8 +333,8 @@ bool CefBrowserHostImpl::IsLoading() {
void CefBrowserHostImpl::Reload() { void CefBrowserHostImpl::Reload() {
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {
if (tab_contents_.get()) if (web_contents_.get())
tab_contents_->GetController().Reload(true); web_contents_->GetController().Reload(true);
} else { } else {
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::Reload, this)); base::Bind(&CefBrowserHostImpl::Reload, this));
@ -342,8 +343,8 @@ void CefBrowserHostImpl::Reload() {
void CefBrowserHostImpl::ReloadIgnoreCache() { void CefBrowserHostImpl::ReloadIgnoreCache() {
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {
if (tab_contents_.get()) if (web_contents_.get())
tab_contents_->GetController().ReloadIgnoringCache(true); web_contents_->GetController().ReloadIgnoringCache(true);
} else { } else {
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::ReloadIgnoreCache, this)); base::Bind(&CefBrowserHostImpl::ReloadIgnoreCache, this));
@ -352,8 +353,8 @@ void CefBrowserHostImpl::ReloadIgnoreCache() {
void CefBrowserHostImpl::StopLoad() { void CefBrowserHostImpl::StopLoad() {
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {
if (tab_contents_.get()) if (web_contents_.get())
tab_contents_->Stop(); web_contents_->Stop();
} else { } else {
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::StopLoad, this)); base::Bind(&CefBrowserHostImpl::StopLoad, this));
@ -494,7 +495,7 @@ void CefBrowserHostImpl::DestroyBrowser() {
registrar_.reset(NULL); registrar_.reset(NULL);
content::WebContentsObserver::Observe(NULL); content::WebContentsObserver::Observe(NULL);
tab_contents_.reset(NULL); web_contents_.reset(NULL);
DetachAllFrames(); DetachAllFrames();
@ -506,14 +507,14 @@ void CefBrowserHostImpl::DestroyBrowser() {
gfx::NativeView CefBrowserHostImpl::GetContentView() const { gfx::NativeView CefBrowserHostImpl::GetContentView() const {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
if (!tab_contents_.get()) if (!web_contents_.get())
return NULL; return NULL;
return tab_contents_->GetNativeView(); return web_contents_->GetNativeView();
} }
TabContents* CefBrowserHostImpl::GetTabContents() const { content::WebContents* CefBrowserHostImpl::GetWebContents() const {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
return tab_contents_.get(); return web_contents_.get();
} }
net::URLRequestContextGetter* CefBrowserHostImpl::GetRequestContext() { net::URLRequestContextGetter* CefBrowserHostImpl::GetRequestContext() {
@ -560,8 +561,8 @@ void CefBrowserHostImpl::Navigate(const CefNavigateParams& params) {
Send(new CefMsg_LoadRequest(routing_id(), request)); Send(new CefMsg_LoadRequest(routing_id(), request));
if (tab_contents_.get()) if (web_contents_.get())
tab_contents_->Focus(); web_contents_->Focus();
} }
void CefBrowserHostImpl::LoadRequest(int64 frame_id, void CefBrowserHostImpl::LoadRequest(int64 frame_id,
@ -594,7 +595,7 @@ void CefBrowserHostImpl::LoadURL(int64 frame_id, const std::string& url) {
if (frame_id == CefFrameHostImpl::kMainFrameId) { if (frame_id == CefFrameHostImpl::kMainFrameId) {
// Go through the navigation controller. // Go through the navigation controller.
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {
if (tab_contents_.get()) { if (web_contents_.get()) {
GURL gurl = GURL(url); GURL gurl = GURL(url);
if (!gurl.is_valid() && !gurl.has_scheme()) { if (!gurl.is_valid() && !gurl.has_scheme()) {
@ -612,12 +613,12 @@ void CefBrowserHostImpl::LoadURL(int64 frame_id, const std::string& url) {
// Update the loading URL. // Update the loading URL.
OnLoadingURLChange(gurl); OnLoadingURLChange(gurl);
tab_contents_->GetController().LoadURL( web_contents_->GetController().LoadURL(
gurl, gurl,
content::Referrer(), content::Referrer(),
content::PAGE_TRANSITION_TYPED, content::PAGE_TRANSITION_TYPED,
std::string()); std::string());
tab_contents_->Focus(); web_contents_->Focus();
} }
} else { } else {
CEF_POST_TASK(CEF_UIT, CEF_POST_TASK(CEF_UIT,
@ -752,14 +753,14 @@ content::WebContents* CefBrowserHostImpl::OpenURLFromTab(
} }
void CefBrowserHostImpl::LoadingStateChanged(content::WebContents* source) { void CefBrowserHostImpl::LoadingStateChanged(content::WebContents* source) {
int current_index = tab_contents_->GetController().GetCurrentEntryIndex(); int current_index = web_contents_->GetController().GetCurrentEntryIndex();
int max_index = tab_contents_->GetController().GetEntryCount() - 1; int max_index = web_contents_->GetController().GetEntryCount() - 1;
bool is_loading, can_go_back, can_go_forward; bool is_loading, can_go_back, can_go_forward;
{ {
base::AutoLock lock_scope(state_lock_); base::AutoLock lock_scope(state_lock_);
is_loading = is_loading_ = tab_contents_->IsLoading(); is_loading = is_loading_ = web_contents_->IsLoading();
can_go_back = can_go_back_ = (current_index > 0); can_go_back = can_go_back_ = (current_index > 0);
can_go_forward = can_go_forward_ = (current_index < max_index); can_go_forward = can_go_forward_ = (current_index < max_index);
} }
@ -777,7 +778,8 @@ bool CefBrowserHostImpl::ShouldCreateWebContents(
content::WebContents* web_contents, content::WebContents* web_contents,
int route_id, int route_id,
WindowContainerType window_container_type, WindowContainerType window_container_type,
const string16& frame_name) { const string16& frame_name,
const GURL& target_url) {
// Start with the current browser window's client and settings. // Start with the current browser window's client and settings.
pending_client_ = client_; pending_client_ = client_;
pending_settings_ = settings_; pending_settings_ = settings_;
@ -830,8 +832,8 @@ void CefBrowserHostImpl::WebContentsCreated(
opener = GetBrowserForContents(source_contents)->GetWindowHandle(); opener = GetBrowserForContents(source_contents)->GetWindowHandle();
CefRefPtr<CefBrowserHostImpl> browser = CefBrowserHostImpl::Create( CefRefPtr<CefBrowserHostImpl> browser = CefBrowserHostImpl::Create(
pending_window_info_, pending_settings_, pending_client_, pending_window_info_, pending_settings_, pending_client_, new_contents,
static_cast<TabContents*>(new_contents), opener); opener);
if (browser.get() && !pending_url_.empty()) if (browser.get() && !pending_url_.empty())
browser->LoadURL(CefFrameHostImpl::kMainFrameId, pending_url_); browser->LoadURL(CefFrameHostImpl::kMainFrameId, pending_url_);
@ -1062,14 +1064,14 @@ void CefBrowserHostImpl::Observe(int type,
CefBrowserHostImpl::CefBrowserHostImpl(const CefWindowInfo& window_info, CefBrowserHostImpl::CefBrowserHostImpl(const CefWindowInfo& window_info,
const CefBrowserSettings& settings, const CefBrowserSettings& settings,
CefRefPtr<CefClient> client, CefRefPtr<CefClient> client,
TabContents* tab_contents, content::WebContents* web_contents,
CefWindowHandle opener) CefWindowHandle opener)
: content::WebContentsObserver(tab_contents), : content::WebContentsObserver(web_contents),
window_info_(window_info), window_info_(window_info),
settings_(settings), settings_(settings),
client_(client), client_(client),
opener_(opener), opener_(opener),
render_process_id_(tab_contents->GetRenderProcessHost()->GetID()), render_process_id_(web_contents->GetRenderProcessHost()->GetID()),
render_view_id_(routing_id()), render_view_id_(routing_id()),
unique_id_(0), unique_id_(0),
received_page_title_(false), received_page_title_(false),
@ -1080,12 +1082,12 @@ CefBrowserHostImpl::CefBrowserHostImpl(const CefWindowInfo& window_info,
queue_messages_(true), queue_messages_(true),
main_frame_id_(CefFrameHostImpl::kInvalidFrameId), main_frame_id_(CefFrameHostImpl::kInvalidFrameId),
focused_frame_id_(CefFrameHostImpl::kInvalidFrameId) { focused_frame_id_(CefFrameHostImpl::kInvalidFrameId) {
tab_contents_.reset(tab_contents); web_contents_.reset(web_contents);
tab_contents->SetDelegate(this); web_contents->SetDelegate(this);
registrar_.reset(new content::NotificationRegistrar); registrar_.reset(new content::NotificationRegistrar);
registrar_->Add(this, content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, registrar_->Add(this, content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED,
content::Source<content::WebContents>(tab_contents)); content::Source<content::WebContents>(web_contents));
placeholder_frame_ = placeholder_frame_ =
new CefFrameHostImpl(this, CefFrameHostImpl::kInvalidFrameId, true); new CefFrameHostImpl(this, CefFrameHostImpl::kInvalidFrameId, true);

View File

@ -22,12 +22,15 @@
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/string16.h" #include "base/string16.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
namespace net {
class URLRequest;
}
struct Cef_Request_Params; struct Cef_Request_Params;
struct Cef_Response_Params; struct Cef_Response_Params;
@ -36,14 +39,14 @@ class SiteInstance;
// Implementation of CefBrowser. // Implementation of CefBrowser.
// //
// WebContentsDelegate: Interface for handling TabContents delegations. There is // WebContentsDelegate: Interface for handling WebContents delegations. There is
// a one-to-one relationship between CefBrowserHostImpl and TabContents // a one-to-one relationship between CefBrowserHostImpl and WebContents
// instances. // instances.
// //
// WebContentsObserver: Interface for observing TabContents notifications and // WebContentsObserver: Interface for observing WebContents notifications and
// IPC messages. There is a one-to-one relationship between TabContents and // IPC messages. There is a one-to-one relationship between WebContents and
// RenderViewHost instances. IPC messages received by the RenderViewHost will be // RenderViewHost instances. IPC messages received by the RenderViewHost will be
// forwarded to this WebContentsObserver implementation via TabContents. IPC // forwarded to this WebContentsObserver implementation via WebContents. IPC
// messages sent using CefBrowserHostImpl::Send() will be forwarded to the // messages sent using CefBrowserHostImpl::Send() will be forwarded to the
// RenderViewHost (after posting to the UI thread if necessary). Use // RenderViewHost (after posting to the UI thread if necessary). Use
// WebContentsObserver::routing_id() when sending IPC messages. // WebContentsObserver::routing_id() when sending IPC messages.
@ -68,7 +71,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
const CefWindowInfo& window_info, const CefWindowInfo& window_info,
const CefBrowserSettings& settings, const CefBrowserSettings& settings,
CefRefPtr<CefClient> client, CefRefPtr<CefClient> client,
TabContents* tab_contents, content::WebContents* web_contents,
CefWindowHandle opener); CefWindowHandle opener);
// Returns the browser associated with the specified RenderViewHost. // Returns the browser associated with the specified RenderViewHost.
@ -127,11 +130,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
// native browser window is not longer processing messages. // native browser window is not longer processing messages.
void DestroyBrowser(); void DestroyBrowser();
// Returns the native view for the TabContents. // Returns the native view for the WebContents.
gfx::NativeView GetContentView() const; gfx::NativeView GetContentView() const;
// Returns a pointer to the TabContents. // Returns a pointer to the WebContents.
TabContents* GetTabContents() const; content::WebContents* GetWebContents() const;
// Returns the browser-specific request context. // Returns the browser-specific request context.
net::URLRequestContextGetter* GetRequestContext(); net::URLRequestContextGetter* GetRequestContext();
@ -188,7 +191,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
content::WebContents* web_contents, content::WebContents* web_contents,
int route_id, int route_id,
WindowContainerType window_container_type, WindowContainerType window_container_type,
const string16& frame_name) OVERRIDE; const string16& frame_name,
const GURL& target_url) OVERRIDE;
virtual void WebContentsCreated(content::WebContents* source_contents, virtual void WebContentsCreated(content::WebContents* source_contents,
int64 source_frame_id, int64 source_frame_id,
const GURL& target_url, const GURL& target_url,
@ -245,7 +249,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefBrowserHostImpl(const CefWindowInfo& window_info, CefBrowserHostImpl(const CefWindowInfo& window_info,
const CefBrowserSettings& settings, const CefBrowserSettings& settings,
CefRefPtr<CefClient> client, CefRefPtr<CefClient> client,
TabContents* tab_contents, content::WebContents* web_contents,
CefWindowHandle opener); CefWindowHandle opener);
// Updates and returns an existing frame or creates a new frame. Pass // Updates and returns an existing frame or creates a new frame. Pass
@ -295,7 +299,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefWindowInfo window_info_; CefWindowInfo window_info_;
CefBrowserSettings settings_; CefBrowserSettings settings_;
CefRefPtr<CefClient> client_; CefRefPtr<CefClient> client_;
scoped_ptr<TabContents> tab_contents_; scoped_ptr<content::WebContents> web_contents_;
CefWindowHandle opener_; CefWindowHandle opener_;
// Unique ids used for routing communication to/from the renderer. We keep a // Unique ids used for routing communication to/from the renderer. We keep a

View File

@ -11,6 +11,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "content/public/browser/web_contents_view.h" #include "content/public/browser/web_contents_view.h"
#include "content/public/common/renderer_preferences.h"
namespace { namespace {
@ -82,13 +83,27 @@ bool CefBrowserHostImpl::PlatformCreateWindow() {
AddRef(); AddRef();
// Parent the TabContents to the browser window. // Parent the TabContents to the browser window.
window_info_.widget = tab_contents_->GetView()->GetNativeView(); window_info_.widget = web_contents_->GetView()->GetNativeView();
gtk_container_add(GTK_CONTAINER(window_info_.parent_widget), gtk_container_add(GTK_CONTAINER(window_info_.parent_widget),
window_info_.widget); window_info_.widget);
g_signal_connect(G_OBJECT(window_info_.widget), "destroy", g_signal_connect(G_OBJECT(window_info_.widget), "destroy",
G_CALLBACK(window_destroyed), this); G_CALLBACK(window_destroyed), this);
// As an additional requirement on Linux, we must set the colors for the
// render widgets in webkit.
content::RendererPreferences* prefs =
web_contents_->GetMutableRendererPrefs();
prefs->focus_ring_color = SkColorSetARGB(255, 229, 151, 0);
prefs->thumb_active_color = SkColorSetRGB(244, 244, 244);
prefs->thumb_inactive_color = SkColorSetRGB(234, 234, 234);
prefs->track_color = SkColorSetRGB(211, 211, 211);
prefs->active_selection_bg_color = SkColorSetRGB(30, 144, 255);
prefs->active_selection_fg_color = SK_ColorWHITE;
prefs->inactive_selection_bg_color = SkColorSetRGB(200, 200, 200);
prefs->inactive_selection_fg_color = SkColorSetRGB(50, 50, 50);
return true; return true;
} }

View File

@ -8,6 +8,7 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include "content/public/browser/web_contents_view.h" #include "content/public/browser/web_contents_view.h"
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
#include "ui/gfx/rect.h" #include "ui/gfx/rect.h"
@ -38,43 +39,6 @@
@end @end
// Common base class for CEF browser windows. Contains methods relating to hole
// punching required in order to display OpenGL underlay windows.
@interface CefBrowserWindow : NSWindow {
@private
int underlaySurfaceCount_;
}
// Informs the window that an underlay surface has been added/removed. The
// window is non-opaque while underlay surfaces are present.
- (void)underlaySurfaceAdded;
- (void)underlaySurfaceRemoved;
@end
@implementation CefBrowserWindow
- (void)underlaySurfaceAdded {
DCHECK_GE(underlaySurfaceCount_, 0);
++underlaySurfaceCount_;
// We're having the OpenGL surface render under the window, so the window
// needs to be not opaque.
if (underlaySurfaceCount_ == 1)
[self setOpaque:NO];
}
- (void)underlaySurfaceRemoved {
--underlaySurfaceCount_;
DCHECK_GE(underlaySurfaceCount_, 0);
if (underlaySurfaceCount_ == 0)
[self setOpaque:YES];
}
@end
bool CefBrowserHostImpl::PlatformViewText(const std::string& text) { bool CefBrowserHostImpl::PlatformViewText(const std::string& text) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return false; return false;
@ -102,7 +66,7 @@ bool CefBrowserHostImpl::PlatformCreateWindow() {
contentRect.size.width = window_rect.size.width; contentRect.size.width = window_rect.size.width;
contentRect.size.height = window_rect.size.height; contentRect.size.height = window_rect.size.height;
newWnd = [[CefBrowserWindow alloc] newWnd = [[UnderlayOpenGLHostingWindow alloc]
initWithContentRect:window_rect initWithContentRect:window_rect
styleMask:(NSTitledWindowMask | styleMask:(NSTitledWindowMask |
NSClosableWindowMask | NSClosableWindowMask |
@ -129,7 +93,7 @@ bool CefBrowserHostImpl::PlatformCreateWindow() {
// Parent the TabContents to the browser view. // Parent the TabContents to the browser view.
const NSRect bounds = [browser_view bounds]; const NSRect bounds = [browser_view bounds];
NSView* native_view = tab_contents_->GetView()->GetNativeView(); NSView* native_view = web_contents_->GetView()->GetNativeView();
[browser_view addSubview:native_view]; [browser_view addSubview:native_view];
[native_view setFrame:bounds]; [native_view setFrame:bounds];
[native_view setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; [native_view setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];

View File

@ -129,9 +129,9 @@ LRESULT CALLBACK CefBrowserHostImpl::WndProc(HWND hwnd, UINT message,
case WM_SETFOCUS: case WM_SETFOCUS:
if (browser) { if (browser) {
TabContents* tab_contents = browser->GetTabContents(); content::WebContents* web_contents = browser->GetWebContents();
if (tab_contents) if (web_contents)
tab_contents->Focus(); web_contents->Focus();
} }
return 0; return 0;
@ -179,7 +179,7 @@ bool CefBrowserHostImpl::PlatformCreateWindow() {
AddRef(); AddRef();
// Parent the TabContents to the browser window. // Parent the TabContents to the browser window.
SetParent(tab_contents_->GetView()->GetNativeView(), window_info_.window); SetParent(web_contents_->GetView()->GetNativeView(), window_info_.window);
// Size the web view window to the browser window. // Size the web view window to the browser window.
RECT cr; RECT cr;

View File

@ -55,7 +55,7 @@ int CefBrowserMainParts::PreCreateThreads() {
} }
void CefBrowserMainParts::PreMainMessageLoopRun() { void CefBrowserMainParts::PreMainMessageLoopRun() {
browser_context_.reset(new CefBrowserContext(this)); browser_context_.reset(new CefBrowserContext());
PlatformInitialize(); PlatformInitialize();
net::NetModule::SetResourceProvider(&ResourceProvider); net::NetModule::SetResourceProvider(&ResourceProvider);

View File

@ -16,6 +16,7 @@
#include "base/file_path.h" #include "base/file_path.h"
#include "content/public/browser/access_token_store.h" #include "content/public/browser/access_token_store.h"
#include "content/public/browser/media_observer.h" #include "content/public/browser/media_observer.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "googleurl/src/gurl.h" #include "googleurl/src/gurl.h"
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
@ -341,7 +342,9 @@ bool CefContentBrowserClient::CanCreateWindow(
const GURL& origin, const GURL& origin,
WindowContainerType container_type, WindowContainerType container_type,
content::ResourceContext* context, content::ResourceContext* context,
int render_process_id) { int render_process_id,
bool* no_javascript_access) {
*no_javascript_access = false;
return true; return true;
} }

View File

@ -156,7 +156,8 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
const GURL& origin, const GURL& origin,
WindowContainerType container_type, WindowContainerType container_type,
content::ResourceContext* context, content::ResourceContext* context,
int render_process_id) OVERRIDE; int render_process_id,
bool* no_javascript_access) OVERRIDE;
virtual std::string GetWorkerProcessTitle( virtual std::string GetWorkerProcessTitle(
const GURL& url, content::ResourceContext* context) OVERRIDE; const GURL& url, content::ResourceContext* context) OVERRIDE;
virtual content::SpeechRecognitionManagerDelegate* virtual content::SpeechRecognitionManagerDelegate*

View File

@ -14,12 +14,12 @@
CefDevToolsDelegate::CefDevToolsDelegate( CefDevToolsDelegate::CefDevToolsDelegate(
int port, int port,
net::URLRequestContextGetter* context_getter) net::URLRequestContextGetter* context_getter) {
: context_getter_(context_getter) {
devtools_http_handler_ = content::DevToolsHttpHandler::Start( devtools_http_handler_ = content::DevToolsHttpHandler::Start(
"127.0.0.1", "127.0.0.1",
port, port,
"", "",
context_getter,
this); this);
} }
@ -36,11 +36,6 @@ std::string CefDevToolsDelegate::GetDiscoveryPageHTML() {
IDR_CEF_DEVTOOLS_DISCOVERY_PAGE).as_string(); IDR_CEF_DEVTOOLS_DISCOVERY_PAGE).as_string();
} }
net::URLRequestContext*
CefDevToolsDelegate::GetURLRequestContext() {
return context_getter_->GetURLRequestContext();
}
bool CefDevToolsDelegate::BundlesFrontendResources() { bool CefDevToolsDelegate::BundlesFrontendResources() {
return true; return true;
} }

View File

@ -30,12 +30,10 @@ class CefDevToolsDelegate : public content::DevToolsHttpHandlerDelegate {
// DevToolsHttpProtocolHandler::Delegate overrides. // DevToolsHttpProtocolHandler::Delegate overrides.
virtual std::string GetDiscoveryPageHTML() OVERRIDE; virtual std::string GetDiscoveryPageHTML() OVERRIDE;
virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE;
virtual bool BundlesFrontendResources() OVERRIDE; virtual bool BundlesFrontendResources() OVERRIDE;
virtual std::string GetFrontendResourcesBaseURL() OVERRIDE; virtual std::string GetFrontendResourcesBaseURL() OVERRIDE;
private: private:
net::URLRequestContextGetter* context_getter_;
content::DevToolsHttpHandler* devtools_http_handler_; content::DevToolsHttpHandler* devtools_http_handler_;
DISALLOW_COPY_AND_ASSIGN(CefDevToolsDelegate); DISALLOW_COPY_AND_ASSIGN(CefDevToolsDelegate);

View File

@ -14,11 +14,10 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/string_util.h" #include "base/string_util.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
#include "content/browser/download/download_state_info.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_manager.h" #include "content/public/browser/download_manager.h"
#include "content/public/browser/web_contents.h"
#include "net/base/net_util.h" #include "net/base/net_util.h"
using content::BrowserThread; using content::BrowserThread;

View File

@ -10,6 +10,8 @@
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
#include "libcef/common/request_impl.h" #include "libcef/common/request_impl.h"
#include "net/base/net_errors.h"
namespace { namespace {
class CefAuthCallbackImpl : public CefAuthCallback { class CefAuthCallbackImpl : public CefAuthCallback {

View File

@ -59,7 +59,7 @@ static NSAutoreleasePool* g_autopool = nil;
// Common base class for CEF browser windows. Contains methods relating to hole // Common base class for CEF browser windows. Contains methods relating to hole
// punching required in order to display OpenGL underlay windows. // punching required in order to display OpenGL underlay windows.
@interface ClientWindow : NSWindow { @interface ClientWindow : NSWindow<CefUnderlayableSurface> {
@private @private
int underlaySurfaceCount_; int underlaySurfaceCount_;
} }