diff options
62 files changed, 1073 insertions, 1296 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_embedder.h b/content/browser/browser_plugin/browser_plugin_embedder.h index d282798..2720e15 100644 --- a/content/browser/browser_plugin/browser_plugin_embedder.h +++ b/content/browser/browser_plugin/browser_plugin_embedder.h @@ -31,7 +31,6 @@ #include "ui/surface/transport_dib.h" #include "webkit/glue/webdropdata.h" -class WebContentsImpl; struct BrowserPluginHostMsg_ResizeGuest_Params; namespace WebKit { @@ -48,6 +47,7 @@ namespace content { class BrowserPluginGuest; class BrowserPluginHostFactory; +class WebContentsImpl; // A browser plugin embedder provides functionality for WebContents to operate // in the 'embedder' role. It manages list of guests inside the embedder. diff --git a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc index a0366f1..494ee76 100644 --- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc +++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc @@ -33,6 +33,7 @@ using WebKit::WebMouseEvent; using content::BrowserPluginEmbedder; using content::BrowserPluginGuest; using content::BrowserPluginHostFactory; +using content::WebContentsImpl; namespace { diff --git a/content/browser/browser_plugin/browser_plugin_host_factory.h b/content/browser/browser_plugin/browser_plugin_host_factory.h index b90b9e0..4443f83 100644 --- a/content/browser/browser_plugin/browser_plugin_host_factory.h +++ b/content/browser/browser_plugin/browser_plugin_host_factory.h @@ -11,13 +11,12 @@ #include "base/string16.h" #include "content/common/content_export.h" -class WebContentsImpl; - namespace content { class BrowserPluginEmbedder; class BrowserPluginGuest; class RenderViewHost; +class WebContentsImpl; // Factory to create BrowserPlugin embedder and guest. class CONTENT_EXPORT BrowserPluginHostFactory { diff --git a/content/browser/browser_plugin/old/old_browser_plugin_host.h b/content/browser/browser_plugin/old/old_browser_plugin_host.h index 7e5cac9..4edeb46 100644 --- a/content/browser/browser_plugin/old/old_browser_plugin_host.h +++ b/content/browser/browser_plugin/old/old_browser_plugin_host.h @@ -15,8 +15,6 @@ #include "ppapi/c/pp_instance.h" #include "ui/gfx/size.h" -class WebContentsImpl; - namespace IPC { struct ChannelHandle; } @@ -24,6 +22,7 @@ struct ChannelHandle; namespace content { class RenderProcessHost; +class WebContentsImpl; namespace old { diff --git a/content/browser/browser_plugin/test_browser_plugin_embedder.h b/content/browser/browser_plugin/test_browser_plugin_embedder.h index e3211734..f594089 100644 --- a/content/browser/browser_plugin/test_browser_plugin_embedder.h +++ b/content/browser/browser_plugin/test_browser_plugin_embedder.h @@ -9,12 +9,11 @@ #include "content/browser/browser_plugin/browser_plugin_embedder.h" #include "content/public/test/test_utils.h" -class WebContentsImpl; - namespace content { class BrowserPluginGuest; class RenderViewHost; +class WebContentsImpl; // Test class for BrowserPluginEmbedder. // diff --git a/content/browser/browser_plugin/test_browser_plugin_guest.h b/content/browser/browser_plugin/test_browser_plugin_guest.h index 747c65c..e6692a4 100644 --- a/content/browser/browser_plugin/test_browser_plugin_guest.h +++ b/content/browser/browser_plugin/test_browser_plugin_guest.h @@ -11,12 +11,11 @@ #include "content/public/test/test_utils.h" #include "ui/gfx/size.h" -class WebContentsImpl; - namespace content { class RenderProcessHost; class RenderViewHost; +class WebContentsImpl; // Test class for BrowserPluginGuest. // diff --git a/content/browser/debugger/devtools_frontend_host.h b/content/browser/debugger/devtools_frontend_host.h index 5c2a936..e93214e 100644 --- a/content/browser/debugger/devtools_frontend_host.h +++ b/content/browser/debugger/devtools_frontend_host.h @@ -12,11 +12,10 @@ #include "content/public/browser/devtools_client_host.h" #include "content/public/browser/render_view_host_observer.h" -class WebContentsImpl; - namespace content { class DevToolsFrontendHostDelegate; +class WebContentsImpl; // This class handles messages from DevToolsClient and calls corresponding // methods on DevToolsFrontendHostDelegate which is implemented by the diff --git a/content/browser/download/save_file_manager.cc b/content/browser/download/save_file_manager.cc index cd7efbf..d4fd8bf 100644 --- a/content/browser/download/save_file_manager.cc +++ b/content/browser/download/save_file_manager.cc @@ -25,6 +25,7 @@ using content::BrowserThread; using content::RenderViewHostImpl; using content::ResourceDispatcherHostImpl; +using content::WebContentsImpl; SaveFileManager::SaveFileManager() : next_id_(0) { diff --git a/content/browser/renderer_host/gtk_key_bindings_handler.cc b/content/browser/renderer_host/gtk_key_bindings_handler.cc index d225fb6..0a3374a 100644 --- a/content/browser/renderer_host/gtk_key_bindings_handler.cc +++ b/content/browser/renderer_host/gtk_key_bindings_handler.cc @@ -12,6 +12,8 @@ #include "base/string_util.h" #include "content/public/browser/native_web_keyboard_event.h" +using content::EditCommand; +using content::EditCommands; using content::NativeWebKeyboardEvent; GtkKeyBindingsHandler::GtkKeyBindingsHandler(GtkWidget* parent_widget) diff --git a/content/browser/renderer_host/gtk_key_bindings_handler.h b/content/browser/renderer_host/gtk_key_bindings_handler.h index b7d9e7a..6bbff29 100644 --- a/content/browser/renderer_host/gtk_key_bindings_handler.h +++ b/content/browser/renderer_host/gtk_key_bindings_handler.h @@ -45,7 +45,7 @@ class CONTENT_EXPORT GtkKeyBindingsHandler { // returned if the key event doesn't correspond to a predefined key binding. // Edit commands matched with |wke| will be stored in |edit_commands|. bool Match(const content::NativeWebKeyboardEvent& wke, - EditCommands* edit_commands); + content::EditCommands* edit_commands); private: // Object structure of Handler class, which is derived from GtkTextView. @@ -125,7 +125,7 @@ class CONTENT_EXPORT GtkKeyBindingsHandler { ui::OwnedWidgetGtk handler_; // Buffer to store the match results. - EditCommands edit_commands_; + content::EditCommands edit_commands_; }; #endif // CONTENT_BROWSER_RENDERER_HOST_GTK_KEY_BINDINGS_HANDLER_H_ diff --git a/content/browser/renderer_host/gtk_key_bindings_handler_unittest.cc b/content/browser/renderer_host/gtk_key_bindings_handler_unittest.cc index 9c92e62..ecee41f 100644 --- a/content/browser/renderer_host/gtk_key_bindings_handler_unittest.cc +++ b/content/browser/renderer_host/gtk_key_bindings_handler_unittest.cc @@ -19,6 +19,8 @@ #include "content/public/common/content_paths.h" #include "testing/gtest/include/gtest/gtest.h" +using content::EditCommand; +using content::EditCommands; using content::NativeWebKeyboardEvent; class GtkKeyBindingsHandlerTest : public testing::Test { diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index 61cdc14..784ea53a 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h @@ -22,7 +22,6 @@ class GURL; class SkBitmap; -class WebContentsImpl; class WebKeyboardEvent; struct ViewHostMsg_CreateWindow_Params; struct ViewHostMsg_DidFailProvisionalLoadWithError_Params; @@ -59,6 +58,7 @@ class RenderViewHost; class RenderViewHostDelegateView; class SessionStorageNamespace; class WebContents; +class WebContentsImpl; struct ContextMenuParams; struct FileChooserParams; struct GlobalRequestID; diff --git a/content/browser/renderer_host/render_view_host_manager_browsertest.cc b/content/browser/renderer_host/render_view_host_manager_browsertest.cc index e2e6d3d..896ead9 100644 --- a/content/browser/renderer_host/render_view_host_manager_browsertest.cc +++ b/content/browser/renderer_host/render_view_host_manager_browsertest.cc @@ -29,6 +29,8 @@ #include "net/base/net_util.h" #include "net/test/test_server.h" +using content::WebContentsImpl; + namespace { bool CompareTrees(base::DictionaryValue* first, base::DictionaryValue* second) { diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 5314b5f..75b6a02 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -65,6 +65,7 @@ using base::Time; using base::TimeDelta; using base::TimeTicks; +using content::EditCommand; using WebKit::WebGestureEvent; using WebKit::WebInputEvent; using WebKit::WebKeyboardEvent; diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index 3eee1f2..b2e8591 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -28,7 +28,6 @@ class MockRenderWidgetHost; class WebCursor; -struct EditCommand; struct ViewHostMsg_UpdateRect_Params; struct ViewHostMsg_TextInputState_Params; struct ViewHostMsg_BeginSmoothScroll_Params; @@ -57,6 +56,7 @@ class WebLayer; namespace content { class BackingStore; +struct EditCommand; class GestureEventFilter; class RenderWidgetHostDelegate; class RenderWidgetHostViewPort; diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h index a17c0a5..61a7745 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h @@ -121,7 +121,7 @@ class RenderWidgetHostViewMacEditCommandHelper; // Contains edit commands received by the -doCommandBySelector: method when // handling a key down event, not including inserting commands, eg. insertTab, // etc. - EditCommands editCommands_; + content::EditCommands editCommands_; // The plugin that currently has focus (-1 if no plugin has focus). int focusedPluginIdentifier_; diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 69bb0cf..57c67ec 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -57,6 +57,7 @@ #include "webkit/plugins/npapi/webplugin.h" using content::BackingStoreMac; +using content::EditCommand; using content::NativeWebKeyboardEvent; using content::RenderViewHostImpl; using content::RenderWidgetHostImpl; diff --git a/content/browser/renderer_host/resource_dispatcher_host_impl.cc b/content/browser/renderer_host/resource_dispatcher_host_impl.cc index 894ac63..60a3c9f 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_impl.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_impl.cc @@ -85,6 +85,7 @@ using base::Time; using base::TimeDelta; using base::TimeTicks; +using content::WebContentsImpl; using webkit_blob::ShareableFileReference; using webkit_glue::ResourceRequestBody; diff --git a/content/browser/renderer_host/resource_dispatcher_host_impl.h b/content/browser/renderer_host/resource_dispatcher_host_impl.h index 4fc1930..8fe8438 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_impl.h +++ b/content/browser/renderer_host/resource_dispatcher_host_impl.h @@ -37,7 +37,6 @@ class ResourceHandler; class SaveFileManager; -class WebContentsImpl; struct ResourceHostMsg_Request; struct ViewMsg_SwapOut_Params; @@ -54,6 +53,7 @@ class ResourceContext; class ResourceDispatcherHostDelegate; class ResourceMessageFilter; class ResourceRequestInfoImpl; +class WebContentsImpl; struct DownloadSaveInfo; struct GlobalRequestID; struct Referrer; diff --git a/content/browser/site_instance_impl_unittest.cc b/content/browser/site_instance_impl_unittest.cc index ce87d4e..21e6914 100644 --- a/content/browser/site_instance_impl_unittest.cc +++ b/content/browser/site_instance_impl_unittest.cc @@ -36,6 +36,7 @@ using content::MockRenderProcessHostFactory; using content::NavigationEntry; using content::NavigationEntryImpl; using content::SiteInstance; +using content::WebContentsImpl; using content::WebUI; using content::WebUIController; diff --git a/content/browser/ssl/ssl_error_handler.cc b/content/browser/ssl/ssl_error_handler.cc index 0db8622..4ae1da2 100644 --- a/content/browser/ssl/ssl_error_handler.cc +++ b/content/browser/ssl/ssl_error_handler.cc @@ -15,6 +15,7 @@ #include "net/url_request/url_request.h" using content::BrowserThread; +using content::NavigationControllerImpl; using content::RenderViewHostImpl; using content::WebContents; using net::SSLInfo; diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc index 45c4238..91d6cfd 100644 --- a/content/browser/ssl/ssl_manager.cc +++ b/content/browser/ssl/ssl_manager.cc @@ -25,6 +25,7 @@ using content::BrowserThread; using content::NavigationController; +using content::NavigationControllerImpl; using content::NavigationEntry; using content::NavigationEntryImpl; using content::ResourceDispatcherHostImpl; diff --git a/content/browser/ssl/ssl_manager.h b/content/browser/ssl/ssl_manager.h index a8f5674..b2e86d4 100644 --- a/content/browser/ssl/ssl_manager.h +++ b/content/browser/ssl/ssl_manager.h @@ -20,11 +20,11 @@ #include "net/base/cert_status_flags.h" #include "net/base/net_errors.h" -class NavigationControllerImpl; class SSLPolicy; namespace content { class NavigationEntryImpl; +class NavigationControllerImpl; struct LoadFromMemoryCacheDetails; struct ResourceRedirectDetails; struct ResourceRequestDetails; @@ -63,11 +63,11 @@ class SSLManager : public content::NotificationObserver { // Called when SSL state for a host or tab changes. Broadcasts the // SSL_INTERNAL_STATE_CHANGED notification. static void NotifySSLInternalStateChanged( - NavigationControllerImpl* controller); + content::NavigationControllerImpl* controller); // Construct an SSLManager for the specified tab. // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used. - explicit SSLManager(NavigationControllerImpl* controller); + explicit SSLManager(content::NavigationControllerImpl* controller); virtual ~SSLManager(); SSLPolicy* policy() { return policy_.get(); } @@ -75,7 +75,7 @@ class SSLManager : public content::NotificationObserver { // The navigation controller associated with this SSLManager. The // NavigationController is guaranteed to outlive the SSLManager. - NavigationControllerImpl* controller() { return controller_; } + content::NavigationControllerImpl* controller() { return controller_; } // This entry point is called directly (instead of via the notification // service) because we need more precise control of the order in which folks @@ -114,7 +114,7 @@ class SSLManager : public content::NotificationObserver { // The NavigationController that owns this SSLManager. We are responsible // for the security UI of this tab. - NavigationControllerImpl* controller_; + content::NavigationControllerImpl* controller_; // Handles registering notifications with the NotificationService. content::NotificationRegistrar registrar_; diff --git a/content/browser/ssl/ssl_policy.cc b/content/browser/ssl/ssl_policy.cc index 897b01b..b1c7d62 100644 --- a/content/browser/ssl/ssl_policy.cc +++ b/content/browser/ssl/ssl_policy.cc @@ -26,6 +26,7 @@ using content::NavigationEntryImpl; using content::SiteInstance; using content::SSLStatus; +using content::WebContentsImpl; namespace { diff --git a/content/browser/ssl/ssl_policy.h b/content/browser/ssl/ssl_policy.h index 9753d65..32edd30 100644 --- a/content/browser/ssl/ssl_policy.h +++ b/content/browser/ssl/ssl_policy.h @@ -13,10 +13,10 @@ class SSLCertErrorHandler; class SSLPolicyBackend; class SSLRequestInfo; -class WebContentsImpl; namespace content { class NavigationEntryImpl; +class WebContentsImpl; } // SSLPolicy @@ -41,7 +41,7 @@ class SSLPolicy { // Update the SSL information in |entry| to match the current state. // |web_contents| is the WebContentsImpl associated with this entry. void UpdateEntry(content::NavigationEntryImpl* entry, - WebContentsImpl* web_contents); + content::WebContentsImpl* web_contents); SSLPolicyBackend* backend() const { return backend_; } diff --git a/content/browser/ssl/ssl_policy_backend.cc b/content/browser/ssl/ssl_policy_backend.cc index 9d25332..7f53e66 100644 --- a/content/browser/ssl/ssl_policy_backend.cc +++ b/content/browser/ssl/ssl_policy_backend.cc @@ -8,6 +8,8 @@ #include "content/browser/web_contents/navigation_controller_impl.h" #include "content/public/browser/browser_context.h" +using content::NavigationControllerImpl; + SSLPolicyBackend::SSLPolicyBackend(NavigationControllerImpl* controller) : ssl_host_state_(SSLHostState::GetFor(controller->GetBrowserContext())), controller_(controller) { diff --git a/content/browser/ssl/ssl_policy_backend.h b/content/browser/ssl/ssl_policy_backend.h index e3681af..8dd20d5 100644 --- a/content/browser/ssl/ssl_policy_backend.h +++ b/content/browser/ssl/ssl_policy_backend.h @@ -12,12 +12,15 @@ #include "base/string16.h" #include "net/base/x509_certificate.h" -class NavigationControllerImpl; class SSLHostState; +namespace content { +class NavigationControllerImpl; +} + class SSLPolicyBackend { public: - explicit SSLPolicyBackend(NavigationControllerImpl* controller); + explicit SSLPolicyBackend(content::NavigationControllerImpl* controller); // Records that a host has run insecure content. void HostRanInsecureContent(const std::string& host, int pid); @@ -39,7 +42,7 @@ class SSLPolicyBackend { // SSL state specific for each host. SSLHostState* ssl_host_state_; - NavigationControllerImpl* controller_; + content::NavigationControllerImpl* controller_; DISALLOW_COPY_AND_ASSIGN(SSLPolicyBackend); }; diff --git a/content/browser/web_contents/interstitial_page_impl.cc b/content/browser/web_contents/interstitial_page_impl.cc index 45bb08a..ef6582d 100644 --- a/content/browser/web_contents/interstitial_page_impl.cc +++ b/content/browser/web_contents/interstitial_page_impl.cc @@ -39,29 +39,10 @@ #include "net/base/escape.h" #include "net/url_request/url_request_context_getter.h" -using content::BrowserThread; -using content::DomOperationNotificationDetails; -using content::InterstitialPageDelegate; -using content::NativeWebKeyboardEvent; -using content::NavigationController; -using content::NavigationEntry; -using content::NavigationEntryImpl; -using content::RenderViewHost; -using content::RenderViewHostImpl; -using content::RenderViewHostDelegate; -using content::RenderViewHostDelegateView; -using content::RenderWidgetHost; -using content::RenderWidgetHostImpl; -using content::RenderWidgetHostView; -using content::RenderWidgetHostViewPort; -using content::ResourceDispatcherHostImpl; -using content::SessionStorageNamespace; -using content::SiteInstance; -using content::WebContents; -using content::WebContentsView; using WebKit::WebDragOperation; using WebKit::WebDragOperationsMask; +namespace content { namespace { void ResourceRequestHelper(ResourceDispatcherHostImpl* rdh, @@ -86,7 +67,7 @@ void ResourceRequestHelper(ResourceDispatcherHostImpl* rdh, } // namespace class InterstitialPageImpl::InterstitialPageRVHDelegateView - : public content::RenderViewHostDelegateView { + : public RenderViewHostDelegateView { public: explicit InterstitialPageRVHDelegateView(InterstitialPageImpl* page); @@ -130,8 +111,6 @@ static void InitInterstitialPageMap() { g_web_contents_to_interstitial_page = new InterstitialPageMap; } -namespace content { - InterstitialPage* InterstitialPage::Create(WebContents* web_contents, bool new_navigation, const GURL& url, @@ -150,8 +129,6 @@ InterstitialPage* InterstitialPage::GetInterstitialPage( return iter->second; } -} // namespace content - InterstitialPageImpl::InterstitialPageImpl(WebContents* web_contents, bool new_navigation, const GURL& url, @@ -215,8 +192,8 @@ void InterstitialPageImpl::Show() { // NOTIFY_WEB_CONTENTS_DESTROYED as at that point the RenderViewHost has // already been destroyed. notification_registrar_.Add( - this, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, - content::Source<RenderWidgetHost>(web_contents_->GetRenderViewHost())); + this, NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, + Source<RenderWidgetHost>(web_contents_->GetRenderViewHost())); // Update the g_web_contents_to_interstitial_page map. iter = g_web_contents_to_interstitial_page->find(web_contents_); @@ -227,7 +204,7 @@ void InterstitialPageImpl::Show() { NavigationEntryImpl* entry = new NavigationEntryImpl; entry->SetURL(url_); entry->SetVirtualURL(url_); - entry->set_page_type(content::PAGE_TYPE_INTERSTITIAL); + entry->set_page_type(PAGE_TYPE_INTERSTITIAL); // Give delegates a chance to set some states on the navigation entry. delegate_->OverrideEntry(entry); @@ -244,15 +221,15 @@ void InterstitialPageImpl::Show() { render_view_host_->NavigateToURL(GURL(data_url)); notification_registrar_.Add(this, - content::NOTIFICATION_WEB_CONTENTS_DESTROYED, - content::Source<WebContents>(web_contents_)); - notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, - content::Source<NavigationController>(&web_contents_->GetController())); - notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, - content::Source<NavigationController>(&web_contents_->GetController())); + NOTIFICATION_WEB_CONTENTS_DESTROYED, + Source<WebContents>(web_contents_)); + notification_registrar_.Add(this, NOTIFICATION_NAV_ENTRY_COMMITTED, + Source<NavigationController>(&web_contents_->GetController())); + notification_registrar_.Add(this, NOTIFICATION_NAV_ENTRY_PENDING, + Source<NavigationController>(&web_contents_->GetController())); notification_registrar_.Add( - this, content::NOTIFICATION_DOM_OPERATION_RESPONSE, - content::Source<RenderViewHost>(render_view_host_)); + this, NOTIFICATION_DOM_OPERATION_RESPONSE, + Source<RenderViewHost>(render_view_host_)); } void InterstitialPageImpl::Hide() { @@ -285,13 +262,13 @@ void InterstitialPageImpl::Hide() { NavigationEntry* entry = web_contents_->GetController().GetActiveEntry(); if (!new_navigation_ && should_revert_web_contents_title_) { entry->SetTitle(original_web_contents_title_); - web_contents_->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TITLE); + web_contents_->NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE); } - content::NotificationService::current()->Notify( - content::NOTIFICATION_INTERSTITIAL_DETACHED, - content::Source<WebContents>(web_contents_), - content::NotificationService::NoDetails()); + NotificationService::current()->Notify( + NOTIFICATION_INTERSTITIAL_DETACHED, + Source<WebContents>(web_contents_), + NotificationService::NoDetails()); InterstitialPageMap::iterator iter = g_web_contents_to_interstitial_page->find(web_contents_); @@ -302,10 +279,10 @@ void InterstitialPageImpl::Hide() { void InterstitialPageImpl::Observe( int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { + const NotificationSource& source, + const NotificationDetails& details) { switch (type) { - case content::NOTIFICATION_NAV_ENTRY_PENDING: + case NOTIFICATION_NAV_ENTRY_PENDING: // We are navigating away from the interstitial (the user has typed a URL // in the location bar or clicked a bookmark). Make sure clicking on the // interstitial will have no effect. Also cancel any blocked requests @@ -318,21 +295,21 @@ void InterstitialPageImpl::Observe( Disable(); TakeActionOnResourceDispatcher(CANCEL); break; - case content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED: + case NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED: if (action_taken_ == NO_ACTION) { // The RenderViewHost is being destroyed (as part of the tab being // closed); make sure we clear the blocked requests. RenderViewHost* rvh = static_cast<RenderViewHost*>( static_cast<RenderViewHostImpl*>( RenderWidgetHostImpl::From( - content::Source<RenderWidgetHost>(source).ptr()))); + Source<RenderWidgetHost>(source).ptr()))); DCHECK(rvh->GetProcess()->GetID() == original_child_id_ && rvh->GetRoutingID() == original_rvh_id_); TakeActionOnResourceDispatcher(CANCEL); } break; - case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: - case content::NOTIFICATION_NAV_ENTRY_COMMITTED: + case NOTIFICATION_WEB_CONTENTS_DESTROYED: + case NOTIFICATION_NAV_ENTRY_COMMITTED: if (action_taken_ == NO_ACTION) { // We are navigating away from the interstitial or closing a tab with an // interstitial. Default to DontProceed(). We don't just call Hide as @@ -346,9 +323,9 @@ void InterstitialPageImpl::Observe( delete this; } break; - case content::NOTIFICATION_DOM_OPERATION_RESPONSE: + case NOTIFICATION_DOM_OPERATION_RESPONSE: if (enabled()) { - content::Details<DomOperationNotificationDetails> dom_op_details( + Details<DomOperationNotificationDetails> dom_op_details( details); delegate_->CommandReceived(dom_op_details->json); } @@ -384,7 +361,7 @@ void InterstitialPageImpl::DidNavigate( DontProceed(); return; } - if (params.transition == content::PAGE_TRANSITION_AUTO_SUBFRAME) { + if (params.transition == PAGE_TRANSITION_AUTO_SUBFRAME) { // No need to handle navigate message from iframe in the interstitial page. return; } @@ -397,10 +374,10 @@ void InterstitialPageImpl::DidNavigate( // after the interstitial page was registered with |web_contents_|, since // there will be a callback to |web_contents_| testing if an interstitial page // is showing before hiding the bookmark bar. - content::NotificationService::current()->Notify( - content::NOTIFICATION_INTERSTITIAL_ATTACHED, - content::Source<WebContents>(web_contents_), - content::NotificationService::NoDetails()); + NotificationService::current()->Notify( + NOTIFICATION_INTERSTITIAL_ATTACHED, + Source<WebContents>(web_contents_), + NotificationService::NoDetails()); RenderWidgetHostView* rwh_view = web_contents_->GetRenderViewHost()->GetView(); @@ -453,11 +430,11 @@ void InterstitialPageImpl::UpdateTitle( // TODO(evan): make use of title_direction. // http://code.google.com/p/chromium/issues/detail?id=27094 entry->SetTitle(title); - web_contents_->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TITLE); + web_contents_->NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE); } -content::RendererPreferences InterstitialPageImpl::GetRendererPrefs( - content::BrowserContext* browser_context) const { +RendererPreferences InterstitialPageImpl::GetRendererPrefs( + BrowserContext* browser_context) const { delegate_->OverrideRendererPrefs(&renderer_preferences_); return renderer_preferences_; } @@ -484,7 +461,6 @@ WebContents* InterstitialPageImpl::web_contents() const { RenderViewHost* InterstitialPageImpl::CreateRenderViewHost() { // Interstitial pages don't want to share the session storage so we mint a // new one. - using content::BrowserContext; BrowserContext* browser_context = web_contents()->GetBrowserContext(); scoped_refptr<SiteInstance> site_instance = SiteInstance::Create(browser_context); @@ -509,7 +485,7 @@ WebContentsView* InterstitialPageImpl::CreateWebContentsView() { RenderWidgetHostView* view = web_contents_view->CreateViewForWidget(render_view_host_); render_view_host_->SetView(view); - render_view_host_->AllowBindings(content::BINDINGS_POLICY_DOM_AUTOMATION); + render_view_host_->AllowBindings(BINDINGS_POLICY_DOM_AUTOMATION); int32 max_page_id = web_contents()-> GetMaxPageIDForSiteInstance(render_view_host_->GetSiteInstance()); @@ -675,8 +651,8 @@ void InterstitialPageImpl::ShowCreatedFullscreenWidget(int route_id) { } void InterstitialPageImpl::ShowContextMenu( - const content::ContextMenuParams& params, - content::ContextMenuSourceType type) { + const ContextMenuParams& params, + ContextMenuSourceType type) { } void InterstitialPageImpl::Disable() { @@ -763,3 +739,5 @@ void InterstitialPageImpl::InterstitialPageRVHDelegateView::OnFindReply( int request_id, int number_of_matches, const gfx::Rect& selection_rect, int active_match_ordinal, bool final_update) { } + +} // namespace content diff --git a/content/browser/web_contents/interstitial_page_impl.h b/content/browser/web_contents/interstitial_page_impl.h index 21fe672..89cb35f 100644 --- a/content/browser/web_contents/interstitial_page_impl.h +++ b/content/browser/web_contents/interstitial_page_impl.h @@ -16,13 +16,11 @@ #include "content/public/common/renderer_preferences.h" #include "googleurl/src/gurl.h" -class WebContentsImpl; - namespace content { class NavigationEntry; class RenderViewHostImpl; class WebContentsView; -} +class WebContentsImpl; enum ResourceRequestAction { BLOCK, @@ -31,10 +29,10 @@ enum ResourceRequestAction { }; class CONTENT_EXPORT InterstitialPageImpl - : public NON_EXPORTED_BASE(content::InterstitialPage), - public content::NotificationObserver, - public content::RenderViewHostDelegate, - public content::RenderWidgetHostDelegate { + : public NON_EXPORTED_BASE(InterstitialPage), + public NotificationObserver, + public RenderViewHostDelegate, + public RenderWidgetHostDelegate { public: // The different state of actions the user can take in an interstitial. enum ActionState { @@ -43,10 +41,10 @@ class CONTENT_EXPORT InterstitialPageImpl DONT_PROCEED_ACTION // "Don't proceed" was selected. }; - InterstitialPageImpl(content::WebContents* web_contents, + InterstitialPageImpl(WebContents* web_contents, bool new_navigation, const GURL& url, - content::InterstitialPageDelegate* delegate); + InterstitialPageDelegate* delegate); virtual ~InterstitialPageImpl(); // InterstitialPage implementation: @@ -54,8 +52,8 @@ class CONTENT_EXPORT InterstitialPageImpl virtual void Hide() OVERRIDE; virtual void DontProceed() OVERRIDE; virtual void Proceed() OVERRIDE; - virtual content::RenderViewHost* GetRenderViewHostForTesting() const OVERRIDE; - virtual content::InterstitialPageDelegate* GetDelegateForTesting() OVERRIDE; + virtual RenderViewHost* GetRenderViewHostForTesting() const OVERRIDE; + virtual InterstitialPageDelegate* GetDelegateForTesting() OVERRIDE; virtual void DontCreateViewForTesting() OVERRIDE; virtual void SetSize(const gfx::Size& size) OVERRIDE; virtual void Focus() OVERRIDE; @@ -76,32 +74,32 @@ class CONTENT_EXPORT InterstitialPageImpl bool reload_on_dont_proceed() const { return reload_on_dont_proceed_; } protected: - // content::NotificationObserver method: + // NotificationObserver method: virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const NotificationSource& source, + const NotificationDetails& details) OVERRIDE; // RenderViewHostDelegate implementation: - virtual content::RenderViewHostDelegateView* GetDelegateView() OVERRIDE; + virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE; virtual const GURL& GetURL() const OVERRIDE; - virtual void RenderViewGone(content::RenderViewHost* render_view_host, + virtual void RenderViewGone(RenderViewHost* render_view_host, base::TerminationStatus status, int error_code) OVERRIDE; virtual void DidNavigate( - content::RenderViewHost* render_view_host, + RenderViewHost* render_view_host, const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; - virtual void UpdateTitle(content::RenderViewHost* render_view_host, + virtual void UpdateTitle(RenderViewHost* render_view_host, int32 page_id, const string16& title, base::i18n::TextDirection title_direction) OVERRIDE; - virtual content::RendererPreferences GetRendererPrefs( - content::BrowserContext* browser_context) const OVERRIDE; + virtual RendererPreferences GetRendererPrefs( + BrowserContext* browser_context) const OVERRIDE; virtual webkit_glue::WebPreferences GetWebkitPrefs() OVERRIDE; virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; virtual void CreateNewWindow( int route_id, const ViewHostMsg_CreateWindow_Params& params, - content::SessionStorageNamespace* session_storage_namespace) OVERRIDE; + SessionStorageNamespace* session_storage_namespace) OVERRIDE; virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type) OVERRIDE; virtual void CreateNewFullscreenWidget(int route_id) OVERRIDE; @@ -113,30 +111,30 @@ class CONTENT_EXPORT InterstitialPageImpl const gfx::Rect& initial_pos) OVERRIDE; virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; virtual void ShowContextMenu( - const content::ContextMenuParams& params, - content::ContextMenuSourceType type) OVERRIDE; + const ContextMenuParams& params, + ContextMenuSourceType type) OVERRIDE; // RenderWidgetHostDelegate implementation: virtual bool PreHandleKeyboardEvent( - const content::NativeWebKeyboardEvent& event, + const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) OVERRIDE; virtual void HandleKeyboardEvent( - const content::NativeWebKeyboardEvent& event) OVERRIDE; + const NativeWebKeyboardEvent& event) OVERRIDE; bool enabled() const { return enabled_; } - content::WebContents* web_contents() const; + WebContents* web_contents() const; const GURL& url() const { return url_; } // Creates the RenderViewHost containing the interstitial content. // Overriden in unit tests. - virtual content::RenderViewHost* CreateRenderViewHost(); + virtual RenderViewHost* CreateRenderViewHost(); // Creates the WebContentsView that shows the interstitial RVH. // Overriden in unit tests. - virtual content::WebContentsView* CreateWebContentsView(); + virtual WebContentsView* CreateWebContentsView(); // Notification magic. - content::NotificationRegistrar notification_registrar_; + NotificationRegistrar notification_registrar_; private: class InterstitialPageRVHDelegateView; @@ -180,7 +178,7 @@ class CONTENT_EXPORT InterstitialPageImpl ActionState action_taken_; // The RenderViewHost displaying the interstitial contents. - content::RenderViewHostImpl* render_view_host_; + RenderViewHostImpl* render_view_host_; // The IDs for the Render[View|Process]Host hidden by this interstitial. int original_child_id_; @@ -206,13 +204,15 @@ class CONTENT_EXPORT InterstitialPageImpl scoped_ptr<InterstitialPageRVHDelegateView> rvh_delegate_view_; // Settings passed to the renderer. - mutable content::RendererPreferences renderer_preferences_; + mutable RendererPreferences renderer_preferences_; bool create_view_; - scoped_ptr<content::InterstitialPageDelegate> delegate_; + scoped_ptr<InterstitialPageDelegate> delegate_; DISALLOW_COPY_AND_ASSIGN(InterstitialPageImpl); }; +} // namespace content + #endif // CONTENT_BROWSER_WEB_CONTENTS_INTERSTITIAL_PAGE_IMPL_H_ diff --git a/content/browser/web_contents/navigation_controller_impl.cc b/content/browser/web_contents/navigation_controller_impl.cc index 024fdae..649d406 100644 --- a/content/browser/web_contents/navigation_controller_impl.cc +++ b/content/browser/web_contents/navigation_controller_impl.cc @@ -39,20 +39,7 @@ #include "net/base/net_util.h" #include "webkit/glue/glue_serialize.h" -using content::BrowserContext; -using content::DOMStorageContext; -using content::GetContentClient; -using content::GlobalRequestID; -using content::NavigationController; -using content::NavigationEntry; -using content::NavigationEntryImpl; -using content::RenderViewHostImpl; -using content::SessionStorageNamespace; -using content::SessionStorageNamespaceMap; -using content::SiteInstance; -using content::UserMetricsAction; -using content::WebContents; - +namespace content { namespace { const int kInvalidateAll = 0xFFFFFFFF; @@ -63,13 +50,13 @@ const int kInvalidateAll = 0xFFFFFFFF; void NotifyPrunedEntries(NavigationControllerImpl* nav_controller, bool from_front, int count) { - content::PrunedDetails details; + PrunedDetails details; details.from_front = from_front; details.count = count; - content::NotificationService::current()->Notify( - content::NOTIFICATION_NAV_LIST_PRUNED, - content::Source<NavigationController>(nav_controller), - content::Details<content::PrunedDetails>(&details)); + NotificationService::current()->Notify( + NOTIFICATION_NAV_LIST_PRUNED, + Source<NavigationController>(nav_controller), + Details<PrunedDetails>(&details)); } // Ensure the given NavigationEntry has a valid state, so that WebKit does not @@ -108,7 +95,7 @@ void ConfigureEntriesForRestore( for (size_t i = 0; i < entries->size(); ++i) { // Use a transition type of reload so that we don't incorrectly increase // the typed count. - (*entries)[i]->SetTransitionType(content::PAGE_TRANSITION_RELOAD); + (*entries)[i]->SetTransitionType(PAGE_TRANSITION_RELOAD); (*entries)[i]->set_restore_type(ControllerRestoreTypeToEntryType(type)); // NOTE(darin): This code is only needed for backwards compat. SetContentStateIfEmpty((*entries)[i].get()); @@ -140,7 +127,7 @@ bool AreURLsInPageNavigation(const GURL& existing_url, // Determines whether or not we should be carrying over a user agent override // between two NavigationEntries. -bool ShouldKeepOverride(const content::NavigationEntry* last_entry) { +bool ShouldKeepOverride(const NavigationEntry* last_entry) { return last_entry && last_entry->GetIsOverridingUserAgent(); } @@ -158,7 +145,6 @@ size_t NavigationControllerImpl::max_entry_count_for_testing_ = // when testing. static bool g_check_for_repost = true; -namespace content { // static NavigationEntry* NavigationController::CreateNavigationEntry( const GURL& url, @@ -197,8 +183,6 @@ void NavigationController::DisablePromptOnRepost() { g_check_for_repost = false; } -} // namespace content - base::Time NavigationControllerImpl::TimeSmoother::GetSmoothedTime( base::Time t) { // If |t| is between the water marks, we're in a run of duplicates @@ -286,13 +270,13 @@ void NavigationControllerImpl::ReloadInternal(bool check_for_repost, if (transient_entry_index_ != -1) { // If an interstitial is showing, treat a reload as a navigation to the // transient entry's URL. - content::NavigationEntryImpl* active_entry = + NavigationEntryImpl* active_entry = NavigationEntryImpl::FromNavigationEntry(GetActiveEntry()); if (!active_entry) return; LoadURL(active_entry->GetURL(), - content::Referrer(), - content::PAGE_TRANSITION_RELOAD, + Referrer(), + PAGE_TRANSITION_RELOAD, active_entry->extra_headers()); return; } @@ -310,10 +294,10 @@ void NavigationControllerImpl::ReloadInternal(bool check_for_repost, // The user is asking to reload a page with POST data. Prompt to make sure // they really want to do this. If they do, the dialog will call us back // with check_for_repost = false. - content::NotificationService::current()->Notify( - content::NOTIFICATION_REPOST_WARNING_SHOWN, - content::Source<NavigationController>(this), - content::NotificationService::NoDetails()); + NotificationService::current()->Notify( + NOTIFICATION_REPOST_WARNING_SHOWN, + Source<NavigationController>(this), + NotificationService::NoDetails()); pending_reload_ = reload_type; web_contents_->Activate(); @@ -356,8 +340,7 @@ void NavigationControllerImpl::ReloadInternal(bool check_for_repost, // See Chromium issue 96041. entries_[pending_entry_index_]->SetTitle(string16()); - entries_[pending_entry_index_]->SetTransitionType( - content::PAGE_TRANSITION_RELOAD); + entries_[pending_entry_index_]->SetTransitionType(PAGE_TRANSITION_RELOAD); } NavigateToPendingEntry(reload_type); @@ -407,10 +390,10 @@ void NavigationControllerImpl::LoadEntry(NavigationEntryImpl* entry) { // result in a download or a 'no content' response (e.g., a mailto: URL). DiscardNonCommittedEntriesInternal(); pending_entry_ = entry; - content::NotificationService::current()->Notify( - content::NOTIFICATION_NAV_ENTRY_PENDING, - content::Source<NavigationController>(this), - content::Details<NavigationEntry>(entry)); + NotificationService::current()->Notify( + NOTIFICATION_NAV_ENTRY_PENDING, + Source<NavigationController>(this), + Details<NavigationEntry>(entry)); NavigateToPendingEntry(NO_RELOAD); } @@ -516,9 +499,9 @@ void NavigationControllerImpl::GoBack() { pending_entry_index_ = current_index - 1; entries_[pending_entry_index_]->SetTransitionType( - content::PageTransitionFromInt( + PageTransitionFromInt( entries_[pending_entry_index_]->GetTransitionType() | - content::PAGE_TRANSITION_FORWARD_BACK)); + PAGE_TRANSITION_FORWARD_BACK)); NavigateToPendingEntry(NO_RELOAD); } @@ -542,9 +525,9 @@ void NavigationControllerImpl::GoForward() { pending_entry_index_++; entries_[pending_entry_index_]->SetTransitionType( - content::PageTransitionFromInt( + PageTransitionFromInt( entries_[pending_entry_index_]->GetTransitionType() | - content::PAGE_TRANSITION_FORWARD_BACK)); + PAGE_TRANSITION_FORWARD_BACK)); NavigateToPendingEntry(NO_RELOAD); } @@ -569,9 +552,9 @@ void NavigationControllerImpl::GoToIndex(int index) { pending_entry_index_ = index; entries_[pending_entry_index_]->SetTransitionType( - content::PageTransitionFromInt( + PageTransitionFromInt( entries_[pending_entry_index_]->GetTransitionType() | - content::PAGE_TRANSITION_FORWARD_BACK)); + PAGE_TRANSITION_FORWARD_BACK)); NavigateToPendingEntry(NO_RELOAD); } @@ -612,8 +595,8 @@ void NavigationControllerImpl::AddTransientEntry(NavigationEntryImpl* entry) { void NavigationControllerImpl::LoadURL( const GURL& url, - const content::Referrer& referrer, - content::PageTransition transition, + const Referrer& referrer, + PageTransition transition, const std::string& extra_headers) { LoadURLParams params(url); params.referrer = referrer; @@ -623,7 +606,7 @@ void NavigationControllerImpl::LoadURL( } void NavigationControllerImpl::LoadURLWithParams(const LoadURLParams& params) { - if (content::HandleDebugURL(params.url, params.transition_type)) + if (HandleDebugURL(params.url, params.transition_type)) return; // Checks based on params.load_type. @@ -706,7 +689,7 @@ void NavigationControllerImpl::DocumentLoadedInFrame() { bool NavigationControllerImpl::RendererDidNavigate( const ViewHostMsg_FrameNavigate_Params& params, - content::LoadCommittedDetails* details) { + LoadCommittedDetails* details) { // Save the previous state before we clobber it. if (GetLastCommittedEntry()) { @@ -736,34 +719,33 @@ bool NavigationControllerImpl::RendererDidNavigate( details->type = ClassifyNavigation(params); switch (details->type) { - case content::NAVIGATION_TYPE_NEW_PAGE: + case NAVIGATION_TYPE_NEW_PAGE: RendererDidNavigateToNewPage(params, details->did_replace_entry); break; - case content::NAVIGATION_TYPE_EXISTING_PAGE: + case NAVIGATION_TYPE_EXISTING_PAGE: RendererDidNavigateToExistingPage(params); break; - case content::NAVIGATION_TYPE_SAME_PAGE: + case NAVIGATION_TYPE_SAME_PAGE: RendererDidNavigateToSamePage(params); break; - case content::NAVIGATION_TYPE_IN_PAGE: + case NAVIGATION_TYPE_IN_PAGE: RendererDidNavigateInPage(params, &details->did_replace_entry); break; - case content::NAVIGATION_TYPE_NEW_SUBFRAME: + case NAVIGATION_TYPE_NEW_SUBFRAME: RendererDidNavigateNewSubframe(params); break; - case content::NAVIGATION_TYPE_AUTO_SUBFRAME: + case NAVIGATION_TYPE_AUTO_SUBFRAME: if (!RendererDidNavigateAutoSubframe(params)) return false; break; - case content::NAVIGATION_TYPE_NAV_IGNORE: + case NAVIGATION_TYPE_NAV_IGNORE: // If a pending navigation was in progress, this canceled it. We should // discard it and make sure it is removed from the URL bar. After that, // there is nothing we can do with this navigation, so we just return to // the caller that nothing has happened. if (pending_entry_) { DiscardNonCommittedEntries(); - web_contents_->NotifyNavigationStateChanged( - content::INVALIDATE_TYPE_URL); + web_contents_->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); } return false; default: @@ -800,7 +782,7 @@ bool NavigationControllerImpl::RendererDidNavigate( // Now prep the rest of the details for the notification and broadcast. details->entry = active_entry; details->is_main_frame = - content::PageTransitionIsMainFrame(params.transition); + PageTransitionIsMainFrame(params.transition); details->serialized_security_info = params.security_info; details->http_status_code = params.http_status_code; NotifyNavigationEntryCommitted(details); @@ -808,7 +790,7 @@ bool NavigationControllerImpl::RendererDidNavigate( return true; } -content::NavigationType NavigationControllerImpl::ClassifyNavigation( +NavigationType NavigationControllerImpl::ClassifyNavigation( const ViewHostMsg_FrameNavigate_Params& params) const { if (params.page_id == -1) { // The renderer generates the page IDs, and so if it gives us the invalid @@ -829,15 +811,15 @@ content::NavigationType NavigationControllerImpl::ClassifyNavigation( // list. // // In these cases, there's nothing we can do with them, so ignore. - return content::NAVIGATION_TYPE_NAV_IGNORE; + return NAVIGATION_TYPE_NAV_IGNORE; } if (params.page_id > web_contents_->GetMaxPageID()) { // Greater page IDs than we've ever seen before are new pages. We may or may // not have a pending entry for the page, and this may or may not be the // main frame. - if (content::PageTransitionIsMainFrame(params.transition)) - return content::NAVIGATION_TYPE_NEW_PAGE; + if (PageTransitionIsMainFrame(params.transition)) + return NAVIGATION_TYPE_NEW_PAGE; // When this is a new subframe navigation, we should have a committed page // for which it's a suframe in. This may not be the case when an iframe is @@ -845,10 +827,10 @@ content::NavigationType NavigationControllerImpl::ClassifyNavigation( // written into the popup by script on the main page). For these cases, // there isn't any navigation stuff we can do, so just ignore it. if (!GetLastCommittedEntry()) - return content::NAVIGATION_TYPE_NAV_IGNORE; + return NAVIGATION_TYPE_NAV_IGNORE; // Valid subframe navigation. - return content::NAVIGATION_TYPE_NEW_SUBFRAME; + return NAVIGATION_TYPE_NEW_SUBFRAME; } // Now we know that the notification is for an existing page. Find that entry. @@ -864,7 +846,7 @@ content::NavigationType NavigationControllerImpl::ClassifyNavigation( // Because the unknown entry has committed, we risk showing the wrong URL in // release builds. Instead, we'll kill the renderer process to be safe. LOG(ERROR) << "terminating renderer for bad navigation: " << params.url; - content::RecordAction(UserMetricsAction("BadMessageTerminate_NC")); + RecordAction(UserMetricsAction("BadMessageTerminate_NC")); // Temporary code so we can get more information. Format: // http://url/foo.html#page1#max3#frame1#ids:2_Nx,1_1x,3_2 @@ -895,16 +877,16 @@ content::NavigationType NavigationControllerImpl::ClassifyNavigation( static_cast<RenderViewHostImpl*>( web_contents_->GetRenderViewHost())->Send( new ViewMsg_TempCrashWithData(url)); - return content::NAVIGATION_TYPE_NAV_IGNORE; + return NAVIGATION_TYPE_NAV_IGNORE; } NavigationEntryImpl* existing_entry = entries_[existing_entry_index].get(); - if (!content::PageTransitionIsMainFrame(params.transition)) { + if (!PageTransitionIsMainFrame(params.transition)) { // All manual subframes would get new IDs and were handled above, so we // know this is auto. Since the current page was found in the navigation // entry list, we're guaranteed to have a last committed entry. DCHECK(GetLastCommittedEntry()); - return content::NAVIGATION_TYPE_AUTO_SUBFRAME; + return NAVIGATION_TYPE_AUTO_SUBFRAME; } // Anything below here we know is a main frame navigation. @@ -919,7 +901,7 @@ content::NavigationType NavigationControllerImpl::ClassifyNavigation( // (the user doesn't want to have a new back/forward entry when they do // this). If this matches the last committed entry, we want to just ignore // the pending entry and go back to where we were (the "existing entry"). - return content::NAVIGATION_TYPE_SAME_PAGE; + return NAVIGATION_TYPE_SAME_PAGE; } // Any toplevel navigations with the same base (minus the reference fragment) @@ -929,20 +911,20 @@ content::NavigationType NavigationControllerImpl::ClassifyNavigation( // an encoding override (it always sends a navigation request). if (AreURLsInPageNavigation(existing_entry->GetURL(), params.url, params.was_within_same_page)) { - return content::NAVIGATION_TYPE_IN_PAGE; + return NAVIGATION_TYPE_IN_PAGE; } // Since we weeded out "new" navigations above, we know this is an existing // (back/forward) navigation. - return content::NAVIGATION_TYPE_EXISTING_PAGE; + return NAVIGATION_TYPE_EXISTING_PAGE; } bool NavigationControllerImpl::IsRedirect( const ViewHostMsg_FrameNavigate_Params& params) { // For main frame transition, we judge by params.transition. // Otherwise, by params.redirects. - if (content::PageTransitionIsMainFrame(params.transition)) { - return content::PageTransitionIsRedirect(params.transition); + if (PageTransitionIsMainFrame(params.transition)) { + return PageTransitionIsRedirect(params.transition); } return params.redirects.size() > 1; } @@ -960,7 +942,7 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage( // Don't use the page type from the pending entry. Some interstitial page // may have set the type to interstitial. Once we commit, however, the page // type must always be normal. - new_entry->set_page_type(content::PAGE_TYPE_NORMAL); + new_entry->set_page_type(PAGE_TYPE_NORMAL); update_virtual_url = new_entry->update_virtual_url_with_url(); } else { new_entry = new NavigationEntryImpl; @@ -1000,7 +982,7 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage( void NavigationControllerImpl::RendererDidNavigateToExistingPage( const ViewHostMsg_FrameNavigate_Params& params) { // We should only get here for main frame navigations. - DCHECK(content::PageTransitionIsMainFrame(params.transition)); + DCHECK(PageTransitionIsMainFrame(params.transition)); // This is a back/forward navigation. The existing page for the ID is // guaranteed to exist by ClassifyNavigation, and we just need to update it @@ -1066,7 +1048,7 @@ void NavigationControllerImpl::RendererDidNavigateToSamePage( void NavigationControllerImpl::RendererDidNavigateInPage( const ViewHostMsg_FrameNavigate_Params& params, bool* did_replace_entry) { - DCHECK(content::PageTransitionIsMainFrame(params.transition)) << + DCHECK(PageTransitionIsMainFrame(params.transition)) << "WebKit should only tell us about in-page navs for the main frame."; // We're guaranteed to have an entry for this one. NavigationEntryImpl* existing_entry = GetEntryWithPageID( @@ -1094,8 +1076,8 @@ void NavigationControllerImpl::RendererDidNavigateInPage( void NavigationControllerImpl::RendererDidNavigateNewSubframe( const ViewHostMsg_FrameNavigate_Params& params) { - if (content::PageTransitionStripQualifier(params.transition) == - content::PAGE_TRANSITION_AUTO_SUBFRAME) { + if (PageTransitionStripQualifier(params.transition) == + PAGE_TRANSITION_AUTO_SUBFRAME) { // This is not user-initiated. Ignore. return; } @@ -1298,7 +1280,7 @@ void NavigationControllerImpl::PruneAllButActive() { void NavigationControllerImpl::SetSessionStorageNamespace( const std::string& partition_id, - content::SessionStorageNamespace* session_storage_namespace) { + SessionStorageNamespace* session_storage_namespace) { if (!session_storage_namespace) return; @@ -1322,8 +1304,7 @@ int32 NavigationControllerImpl::GetMaxRestoredPageID() const { } SessionStorageNamespace* -NavigationControllerImpl::GetSessionStorageNamespace( - content::SiteInstance* instance) { +NavigationControllerImpl::GetSessionStorageNamespace(SiteInstance* instance) { std::string partition_id; if (instance) { // TODO(ajwong): When GetDefaultSessionStorageNamespace() goes away, remove @@ -1342,7 +1323,7 @@ NavigationControllerImpl::GetSessionStorageNamespace( // // TODO(ajwong): Should this use the |partition_id| directly rather than // re-lookup via |instance|? http://crbug.com/142685 - content::StoragePartition* partition = + StoragePartition* partition = BrowserContext::GetStoragePartition(browser_context_, instance); SessionStorageNamespaceImpl* session_storage_namespace = new SessionStorageNamespaceImpl( @@ -1400,7 +1381,7 @@ int NavigationControllerImpl::GetPendingEntryIndex() const { void NavigationControllerImpl::InsertOrReplaceEntry(NavigationEntryImpl* entry, bool replace) { - DCHECK(entry->GetTransitionType() != content::PAGE_TRANSITION_AUTO_SUBFRAME); + DCHECK(entry->GetTransitionType() != PAGE_TRANSITION_AUTO_SUBFRAME); // Copy the pending entry's unique ID to the committed entry. // I don't know if pending_entry_index_ can be other than -1 here. @@ -1465,7 +1446,7 @@ void NavigationControllerImpl::NavigateToPendingEntry(ReloadType reload_type) { (entries_[pending_entry_index_]->restore_type() == NavigationEntryImpl::RESTORE_NONE) && (entries_[pending_entry_index_]->GetTransitionType() & - content::PAGE_TRANSITION_FORWARD_BACK)) { + PAGE_TRANSITION_FORWARD_BACK)) { web_contents_->Stop(); // If an interstitial page is showing, we want to close it to get back @@ -1508,10 +1489,10 @@ void NavigationControllerImpl::NavigateToPendingEntry(ReloadType reload_type) { } void NavigationControllerImpl::NotifyNavigationEntryCommitted( - content::LoadCommittedDetails* details) { + LoadCommittedDetails* details) { details->entry = GetActiveEntry(); - content::NotificationDetails notification_details = - content::Details<content::LoadCommittedDetails>(details); + NotificationDetails notification_details = + Details<LoadCommittedDetails>(details); // We need to notify the ssl_manager_ before the web_contents_ so the // location bar will have up-to-date information about the security style @@ -1523,9 +1504,9 @@ void NavigationControllerImpl::NotifyNavigationEntryCommitted( // notification below instead. web_contents_->NotifyNavigationStateChanged(kInvalidateAll); - content::NotificationService::current()->Notify( - content::NOTIFICATION_NAV_ENTRY_COMMITTED, - content::Source<NavigationController>(this), + NotificationService::current()->Notify( + NOTIFICATION_NAV_ENTRY_COMMITTED, + Source<NavigationController>(this), notification_details); } @@ -1533,7 +1514,7 @@ void NavigationControllerImpl::NotifyNavigationEntryCommitted( size_t NavigationControllerImpl::max_entry_count() { if (max_entry_count_for_testing_ != kMaxEntryCountForTestingNotSet) return max_entry_count_for_testing_; - return content::kMaxSessionHistoryEntries; + return kMaxSessionHistoryEntries; } void NavigationControllerImpl::SetActive(bool is_active) { @@ -1554,13 +1535,13 @@ void NavigationControllerImpl::LoadIfNecessary() { void NavigationControllerImpl::NotifyEntryChanged(const NavigationEntry* entry, int index) { - content::EntryChangedDetails det; + EntryChangedDetails det; det.changed_entry = entry; det.index = index; - content::NotificationService::current()->Notify( - content::NOTIFICATION_NAV_ENTRY_CHANGED, - content::Source<NavigationController>(this), - content::Details<content::EntryChangedDetails>(&det)); + NotificationService::current()->Notify( + NOTIFICATION_NAV_ENTRY_CHANGED, + Source<NavigationController>(this), + Details<EntryChangedDetails>(&det)); } void NavigationControllerImpl::FinishRestore(int selected_index, @@ -1615,7 +1596,7 @@ void NavigationControllerImpl::InsertEntriesFrom( for (int i = 0; i < max_index; i++) { // When cloning a tab, copy all entries except interstitial pages if (source.entries_[i].get()->GetPageType() != - content::PAGE_TYPE_INTERSTITIAL) { + PAGE_TYPE_INTERSTITIAL) { entries_.insert(entries_.begin() + insert_index++, linked_ptr<NavigationEntryImpl>( new NavigationEntryImpl(*source.entries_[i]))); @@ -1627,3 +1608,5 @@ void NavigationControllerImpl::SetGetTimestampCallbackForTest( const base::Callback<base::Time()>& get_timestamp_callback) { get_timestamp_callback_ = get_timestamp_callback; } + +} // namespace content diff --git a/content/browser/web_contents/navigation_controller_impl.h b/content/browser/web_contents/navigation_controller_impl.h index 0a13bca..5fd8b14 100644 --- a/content/browser/web_contents/navigation_controller_impl.h +++ b/content/browser/web_contents/navigation_controller_impl.h @@ -16,47 +16,46 @@ #include "content/public/browser/navigation_type.h" struct ViewHostMsg_FrameNavigate_Params; -class WebContentsImpl; namespace content { class NavigationEntryImpl; -struct LoadCommittedDetails; +class WebContentsImpl; class SiteInstance; -} +struct LoadCommittedDetails; class CONTENT_EXPORT NavigationControllerImpl - : public NON_EXPORTED_BASE(content::NavigationController) { + : public NON_EXPORTED_BASE(NavigationController) { public: NavigationControllerImpl( WebContentsImpl* web_contents, - content::BrowserContext* browser_context); + BrowserContext* browser_context); virtual ~NavigationControllerImpl(); // NavigationController implementation: - virtual content::WebContents* GetWebContents() const OVERRIDE; - virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; + virtual WebContents* GetWebContents() const OVERRIDE; + virtual BrowserContext* GetBrowserContext() const OVERRIDE; virtual void SetBrowserContext( - content::BrowserContext* browser_context) OVERRIDE; + BrowserContext* browser_context) OVERRIDE; virtual void Restore( int selected_navigation, RestoreType type, - std::vector<content::NavigationEntry*>* entries) OVERRIDE; - virtual content::NavigationEntry* GetActiveEntry() const OVERRIDE; - virtual content::NavigationEntry* GetVisibleEntry() const OVERRIDE; + std::vector<NavigationEntry*>* entries) OVERRIDE; + virtual NavigationEntry* GetActiveEntry() const OVERRIDE; + virtual NavigationEntry* GetVisibleEntry() const OVERRIDE; virtual int GetCurrentEntryIndex() const OVERRIDE; - virtual content::NavigationEntry* GetLastCommittedEntry() const OVERRIDE; + virtual NavigationEntry* GetLastCommittedEntry() const OVERRIDE; virtual int GetLastCommittedEntryIndex() const OVERRIDE; virtual bool CanViewSource() const OVERRIDE; virtual int GetEntryCount() const OVERRIDE; - virtual content::NavigationEntry* GetEntryAtIndex(int index) const OVERRIDE; - virtual content::NavigationEntry* GetEntryAtOffset(int offset) const OVERRIDE; + virtual NavigationEntry* GetEntryAtIndex(int index) const OVERRIDE; + virtual NavigationEntry* GetEntryAtOffset(int offset) const OVERRIDE; virtual void DiscardNonCommittedEntries() OVERRIDE; - virtual content::NavigationEntry* GetPendingEntry() const OVERRIDE; + virtual NavigationEntry* GetPendingEntry() const OVERRIDE; virtual int GetPendingEntryIndex() const OVERRIDE; - virtual content::NavigationEntry* GetTransientEntry() const OVERRIDE; + virtual NavigationEntry* GetTransientEntry() const OVERRIDE; virtual void LoadURL(const GURL& url, - const content::Referrer& referrer, - content::PageTransition type, + const Referrer& referrer, + PageTransition type, const std::string& extra_headers) OVERRIDE; virtual void LoadURLWithParams(const LoadURLParams& params) OVERRIDE; virtual void LoadIfNecessary() OVERRIDE; @@ -68,9 +67,9 @@ class CONTENT_EXPORT NavigationControllerImpl virtual void GoToIndex(int index) OVERRIDE; virtual void GoToOffset(int offset) OVERRIDE; virtual void RemoveEntryAtIndex(int index) OVERRIDE; - virtual const content::SessionStorageNamespaceMap& + virtual const SessionStorageNamespaceMap& GetSessionStorageNamespaceMap() const OVERRIDE; - virtual content::SessionStorageNamespace* + virtual SessionStorageNamespace* GetDefaultSessionStorageNamespace() OVERRIDE; virtual void SetMaxRestoredPageID(int32 max_id) OVERRIDE; virtual int32 GetMaxRestoredPageID() const OVERRIDE; @@ -81,32 +80,32 @@ class CONTENT_EXPORT NavigationControllerImpl virtual void Reload(bool check_for_repost) OVERRIDE; virtual void ReloadIgnoringCache(bool check_for_repost) OVERRIDE; virtual void ReloadOriginalRequestURL(bool check_for_repost) OVERRIDE; - virtual void NotifyEntryChanged(const content::NavigationEntry* entry, + virtual void NotifyEntryChanged(const NavigationEntry* entry, int index) OVERRIDE; virtual void CopyStateFrom( - const content::NavigationController& source) OVERRIDE; + const NavigationController& source) OVERRIDE; virtual void CopyStateFromAndPrune( - content::NavigationController* source) OVERRIDE; + NavigationController* source) OVERRIDE; virtual void PruneAllButActive() OVERRIDE; // The session storage namespace that all child RenderViews belonging to // |instance| should use. - content::SessionStorageNamespace* GetSessionStorageNamespace( - content::SiteInstance* instance); + SessionStorageNamespace* GetSessionStorageNamespace( + SiteInstance* instance); // Returns the index of the specified entry, or -1 if entry is not contained // in this NavigationController. - int GetIndexOfEntry(const content::NavigationEntryImpl* entry) const; + int GetIndexOfEntry(const NavigationEntryImpl* entry) const; // Return the index of the entry with the corresponding instance and page_id, // or -1 if not found. - int GetEntryIndexWithPageID(content::SiteInstance* instance, + int GetEntryIndexWithPageID(SiteInstance* instance, int32 page_id) const; // Return the entry with the corresponding instance and page_id, or NULL if // not found. - content::NavigationEntryImpl* GetEntryWithPageID( - content::SiteInstance* instance, + NavigationEntryImpl* GetEntryWithPageID( + SiteInstance* instance, int32 page_id) const; // Transient entry ----------------------------------------------------------- @@ -118,7 +117,7 @@ class CONTENT_EXPORT NavigationControllerImpl // represented as an entry, but should go away when the user navigates away // from them. // Note that adding a transient entry does not change the active contents. - void AddTransientEntry(content::NavigationEntryImpl* entry); + void AddTransientEntry(NavigationEntryImpl* entry); // WebContentsImpl ----------------------------------------------------------- @@ -142,7 +141,7 @@ class CONTENT_EXPORT NavigationControllerImpl // In the case that nothing has changed, the details structure is undefined // and it will return false. bool RendererDidNavigate(const ViewHostMsg_FrameNavigate_Params& params, - content::LoadCommittedDetails* details); + LoadCommittedDetails* details); // Notifies us that we just became active. This is used by the WebContentsImpl // so that we know to load URLs that were pending as "lazy" loads. @@ -181,7 +180,7 @@ class CONTENT_EXPORT NavigationControllerImpl // associated with a |partition_id| will CHECK() fail. void SetSessionStorageNamespace( const std::string& partition_id, - content::SessionStorageNamespace* session_storage_namespace); + SessionStorageNamespace* session_storage_namespace); // Random data --------------------------------------------------------------- @@ -222,13 +221,13 @@ class CONTENT_EXPORT NavigationControllerImpl }; // Classifies the given renderer navigation (see the NavigationType enum). - content::NavigationType ClassifyNavigation( + NavigationType ClassifyNavigation( const ViewHostMsg_FrameNavigate_Params& params) const; // Causes the controller to load the specified entry. The function assumes // ownership of the pointer since it is put in the navigation list. // NOTE: Do not pass an entry that the controller already owns! - void LoadEntry(content::NavigationEntryImpl* entry); + void LoadEntry(NavigationEntryImpl* entry); // Handlers for the different types of navigation types. They will actually // handle the navigations corresponding to the different NavClasses above. @@ -263,11 +262,11 @@ class CONTENT_EXPORT NavigationControllerImpl // Allows the derived class to issue notifications that a load has been // committed. This will fill in the active entry to the details structure. - void NotifyNavigationEntryCommitted(content::LoadCommittedDetails* details); + void NotifyNavigationEntryCommitted(LoadCommittedDetails* details); // Updates the virtual URL of an entry to match a new URL, for cases where // the real renderer URL is derived from the virtual URL, like view-source: - void UpdateVirtualURLToURL(content::NavigationEntryImpl* entry, + void UpdateVirtualURLToURL(NavigationEntryImpl* entry, const GURL& new_url); // Invoked after session/tab restore or cloning a tab. Resets the transition @@ -277,7 +276,7 @@ class CONTENT_EXPORT NavigationControllerImpl // Inserts a new entry or replaces the current entry with a new one, removing // all entries after it. The new entry will become the active one. - void InsertOrReplaceEntry(content::NavigationEntryImpl* entry, bool replace); + void InsertOrReplaceEntry(NavigationEntryImpl* entry, bool replace); // Removes the entry at |index|, as long as it is not the current entry. void RemoveEntryAtIndexInternal(int index); @@ -312,11 +311,10 @@ class CONTENT_EXPORT NavigationControllerImpl // --------------------------------------------------------------------------- // The user browser context associated with this controller. - content::BrowserContext* browser_context_; + BrowserContext* browser_context_; // List of NavigationEntry for this tab - typedef std::vector<linked_ptr<content::NavigationEntryImpl> > - NavigationEntries; + typedef std::vector<linked_ptr<NavigationEntryImpl> > NavigationEntries; NavigationEntries entries_; // An entry we haven't gotten a response for yet. This will be discarded @@ -326,7 +324,7 @@ class CONTENT_EXPORT NavigationControllerImpl // This may refer to an item in the entries_ list if the pending_entry_index_ // == -1, or it may be its own entry that should be deleted. Be careful with // the memory management. - content::NavigationEntryImpl* pending_entry_; + NavigationEntryImpl* pending_entry_; // currently visible entry int last_committed_entry_index_; @@ -368,7 +366,7 @@ class CONTENT_EXPORT NavigationControllerImpl // different StoragePartitions. Even though they are part of the same // NavigationController, only entries in the same StoragePartition may // share session storage state with one another. - content::SessionStorageNamespaceMap session_storage_namespace_map_; + SessionStorageNamespaceMap session_storage_namespace_map_; // The maximum number of entries that a navigation controller can store. static size_t max_entry_count_for_testing_; @@ -390,4 +388,6 @@ class CONTENT_EXPORT NavigationControllerImpl DISALLOW_COPY_AND_ASSIGN(NavigationControllerImpl); }; +} // namespace content + #endif // CONTENT_BROWSER_WEB_CONTENTS_NAVIGATION_CONTROLLER_IMPL_H_ diff --git a/content/browser/web_contents/navigation_controller_impl_unittest.cc b/content/browser/web_contents/navigation_controller_impl_unittest.cc index 046bc38..07deff6 100644 --- a/content/browser/web_contents/navigation_controller_impl_unittest.cc +++ b/content/browser/web_contents/navigation_controller_impl_unittest.cc @@ -39,16 +39,8 @@ #include "webkit/glue/glue_serialize.h" using base::Time; -using content::NavigationController; -using content::NavigationEntry; -using content::NavigationEntryImpl; -using content::RenderViewHostImplTestHarness; -using content::SessionStorageNamespaceMap; -using content::SiteInstance; -using content::TestNotificationTracker; -using content::TestRenderViewHost; -using content::TestWebContents; -using content::WebContents; + +namespace content { // TimeSmoother tests ---------------------------------------------------------- @@ -120,22 +112,19 @@ class NavigationControllerTest : public RenderViewHostImplTestHarness { void RegisterForAllNavNotifications(TestNotificationTracker* tracker, NavigationController* controller) { - tracker->ListenFor(content::NOTIFICATION_NAV_ENTRY_COMMITTED, - content::Source<NavigationController>( - controller)); - tracker->ListenFor(content::NOTIFICATION_NAV_LIST_PRUNED, - content::Source<NavigationController>( - controller)); - tracker->ListenFor(content::NOTIFICATION_NAV_ENTRY_CHANGED, - content::Source<NavigationController>( - controller)); + tracker->ListenFor(NOTIFICATION_NAV_ENTRY_COMMITTED, + Source<NavigationController>(controller)); + tracker->ListenFor(NOTIFICATION_NAV_LIST_PRUNED, + Source<NavigationController>(controller)); + tracker->ListenFor(NOTIFICATION_NAV_ENTRY_CHANGED, + Source<NavigationController>(controller)); } SiteInstance* GetSiteInstanceFromEntry(NavigationEntry* entry) { return NavigationEntryImpl::FromNavigationEntry(entry)->site_instance(); } -class TestWebContentsDelegate : public content::WebContentsDelegate { +class TestWebContentsDelegate : public WebContentsDelegate { public: explicit TestWebContentsDelegate() : navigation_state_change_count_(0) {} @@ -183,8 +172,7 @@ TEST_F(NavigationControllerTest, GoToOffset) { } test_rvh()->SendNavigate(0, urls[0]); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(urls[0], controller.GetActiveEntry()->GetVirtualURL()); EXPECT_FALSE(controller.CanGoBack()); EXPECT_FALSE(controller.CanGoForward()); @@ -192,8 +180,7 @@ TEST_F(NavigationControllerTest, GoToOffset) { for (int i = 1; i <= 4; ++i) { test_rvh()->SendNavigate(i, urls[i]); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(urls[i], controller.GetActiveEntry()->GetVirtualURL()); EXPECT_TRUE(controller.CanGoToOffset(-i)); EXPECT_FALSE(controller.CanGoToOffset(-(i + 1))); @@ -227,8 +214,7 @@ TEST_F(NavigationControllerTest, GoToOffset) { // Check that the GoToOffset will land on the expected page. EXPECT_EQ(urls[url_index], controller.GetPendingEntry()->GetVirtualURL()); test_rvh()->SendNavigate(url_index, urls[url_index]); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // Check that we can go to any valid offset into the history. for (size_t j = 0; j < urls.size(); ++j) EXPECT_TRUE(controller.CanGoToOffset(j - url_index)); @@ -246,8 +232,7 @@ TEST_F(NavigationControllerTest, LoadURL) { const GURL url1("http://foo1"); const GURL url2("http://foo2"); - controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); // Creating a pending notification should not have issued any of the // notifications we're listening for. EXPECT_EQ(0U, notifications.size()); @@ -271,8 +256,7 @@ TEST_F(NavigationControllerTest, LoadURL) { EXPECT_EQ(0U, notifications.size()); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // The load should now be committed. EXPECT_EQ(controller.GetEntryCount(), 1); @@ -290,8 +274,7 @@ TEST_F(NavigationControllerTest, LoadURL) { EXPECT_FALSE(controller.GetActiveEntry()->GetTimestamp().is_null()); // Load another... - controller.LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); // The load should now be pending. EXPECT_EQ(controller.GetEntryCount(), 1); @@ -313,8 +296,7 @@ TEST_F(NavigationControllerTest, LoadURL) { test_rvh()->SendShouldCloseACK(true); static_cast<TestRenderViewHost*>( contents()->GetPendingRenderViewHost())->SendNavigate(1, url2); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // The load should now be committed. EXPECT_EQ(controller.GetEntryCount(), 2); @@ -351,23 +333,19 @@ TEST_F(NavigationControllerTest, LoadURLSameTime) { const GURL url1("http://foo1"); const GURL url2("http://foo2"); - controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // Load another... - controller.LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); // Simulate the beforeunload ack for the cross-site transition, and then the // commit. test_rvh()->SendShouldCloseACK(true); test_rvh()->SendNavigate(1, url2); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // The two loads should now be committed. ASSERT_EQ(controller.GetEntryCount(), 2); @@ -410,14 +388,14 @@ TEST_F(NavigationControllerTest, LoadURLWithParams) { NavigationControllerImpl& controller = controller_impl(); NavigationController::LoadURLParams load_params(GURL("http://foo")); - load_params.referrer = content::Referrer(GURL("http://referrer"), - WebKit::WebReferrerPolicyDefault); - load_params.transition_type = content::PAGE_TRANSITION_GENERATED; + load_params.referrer = + Referrer(GURL("http://referrer"), WebKit::WebReferrerPolicyDefault); + load_params.transition_type = PAGE_TRANSITION_GENERATED; load_params.extra_headers = "content-type: text/plain"; load_params.load_type = NavigationController::LOAD_TYPE_DEFAULT; load_params.is_renderer_initiated = true; load_params.override_user_agent = NavigationController::UA_OVERRIDE_TRUE; - load_params.transferred_global_request_id = content::GlobalRequestID(2,3); + load_params.transferred_global_request_id = GlobalRequestID(2,3); controller.LoadURLWithParams(load_params); NavigationEntryImpl* entry = @@ -453,7 +431,7 @@ TEST_F(NavigationControllerTest, LoadURLWithExtraParams_HttpPost) { NavigationControllerImpl& controller = controller_impl(); NavigationController::LoadURLParams load_params(GURL("https://posturl")); - load_params.transition_type = content::PAGE_TRANSITION_TYPED; + load_params.transition_type = PAGE_TRANSITION_TYPED; load_params.load_type = NavigationController::LOAD_TYPE_BROWSER_INITIATED_HTTP_POST; load_params.override_user_agent = NavigationController::UA_OVERRIDE_TRUE; @@ -486,23 +464,19 @@ TEST_F(NavigationControllerTest, LoadURL_SamePage) { const GURL url1("http://foo1"); - controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(0U, notifications.size()); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); ASSERT_TRUE(controller.GetActiveEntry()); const base::Time timestamp = controller.GetActiveEntry()->GetTimestamp(); EXPECT_FALSE(timestamp.is_null()); - controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(0U, notifications.size()); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // We should not have produced a new session history entry. EXPECT_EQ(controller.GetEntryCount(), 1); @@ -530,19 +504,16 @@ TEST_F(NavigationControllerTest, LoadURL_Discarded) { const GURL url1("http://foo1"); const GURL url2("http://foo2"); - controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(0U, notifications.size()); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); ASSERT_TRUE(controller.GetActiveEntry()); const base::Time timestamp = controller.GetActiveEntry()->GetTimestamp(); EXPECT_FALSE(timestamp.is_null()); - controller.LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); controller.DiscardNonCommittedEntries(); EXPECT_EQ(0U, notifications.size()); @@ -569,11 +540,10 @@ TEST_F(NavigationControllerTest, LoadURL_NoPending) { // First make an existing committed entry. const GURL kExistingURL1("http://eh"); - controller.LoadURL(kExistingURL1, content::Referrer(), - content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL( + kExistingURL1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(0, kExistingURL1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // Do a new navigation without making a pending one. const GURL kNewURL("http://see"); @@ -581,8 +551,7 @@ TEST_F(NavigationControllerTest, LoadURL_NoPending) { // There should no longer be any pending entry, and the third navigation we // just made should be committed. - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(-1, controller.GetPendingEntryIndex()); EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); EXPECT_EQ(kNewURL, controller.GetActiveEntry()->GetURL()); @@ -599,16 +568,15 @@ TEST_F(NavigationControllerTest, LoadURL_NewPending) { // First make an existing committed entry. const GURL kExistingURL1("http://eh"); - controller.LoadURL(kExistingURL1, content::Referrer(), - content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL( + kExistingURL1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(0, kExistingURL1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // Make a pending entry to somewhere new. const GURL kExistingURL2("http://bee"); - controller.LoadURL(kExistingURL2, content::Referrer(), - content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL( + kExistingURL2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(0U, notifications.size()); // After the beforeunload but before it commits, do a new navigation. @@ -619,8 +587,7 @@ TEST_F(NavigationControllerTest, LoadURL_NewPending) { // There should no longer be any pending entry, and the third navigation we // just made should be committed. - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(-1, controller.GetPendingEntryIndex()); EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); EXPECT_EQ(kNewURL, controller.GetActiveEntry()->GetURL()); @@ -636,18 +603,16 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) { // First make some history. const GURL kExistingURL1("http://foo/eh"); - controller.LoadURL(kExistingURL1, content::Referrer(), - content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL( + kExistingURL1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(0, kExistingURL1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); const GURL kExistingURL2("http://foo/bee"); - controller.LoadURL(kExistingURL2, content::Referrer(), - content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL( + kExistingURL2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(1, kExistingURL2); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // Now make a pending back/forward navigation. The zeroth entry should be // pending. @@ -658,13 +623,12 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) { // Before that commits, do a new navigation. const GURL kNewURL("http://foo/see"); - content::LoadCommittedDetails details; + LoadCommittedDetails details; test_rvh()->SendNavigate(3, kNewURL); // There should no longer be any pending entry, and the third navigation we // just made should be committed. - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(-1, controller.GetPendingEntryIndex()); EXPECT_EQ(2, controller.GetLastCommittedEntryIndex()); EXPECT_EQ(kNewURL, controller.GetActiveEntry()->GetURL()); @@ -680,24 +644,21 @@ TEST_F(NavigationControllerTest, LoadURL_BackPreemptsPending) { // First make some history. const GURL kExistingURL1("http://foo/eh"); - controller.LoadURL(kExistingURL1, content::Referrer(), - content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL( + kExistingURL1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(0, kExistingURL1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); const GURL kExistingURL2("http://foo/bee"); - controller.LoadURL(kExistingURL2, content::Referrer(), - content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL( + kExistingURL2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(1, kExistingURL2); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // Now make a pending new navigation. const GURL kNewURL("http://foo/see"); controller.LoadURL( - kNewURL, content::Referrer(), content::PAGE_TRANSITION_TYPED, - std::string()); + kNewURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(0U, notifications.size()); EXPECT_EQ(-1, controller.GetPendingEntryIndex()); EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); @@ -707,8 +668,7 @@ TEST_F(NavigationControllerTest, LoadURL_BackPreemptsPending) { // There should no longer be any pending entry, and the back navigation we // just made should be committed. - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(-1, controller.GetPendingEntryIndex()); EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); EXPECT_EQ(kExistingURL1, controller.GetActiveEntry()->GetURL()); @@ -733,8 +693,7 @@ TEST_F(NavigationControllerTest, LoadURL_IgnorePreemptsPending) { // Now make a pending new navigation. const GURL kNewURL("http://eh"); controller.LoadURL( - kNewURL, content::Referrer(), content::PAGE_TRANSITION_TYPED, - std::string()); + kNewURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(0U, notifications.size()); EXPECT_EQ(-1, controller.GetPendingEntryIndex()); EXPECT_TRUE(controller.GetPendingEntry()); @@ -774,8 +733,7 @@ TEST_F(NavigationControllerTest, LoadURL_AbortDoesntCancelPending) { // Now make a pending new navigation. const GURL kNewURL("http://eh"); controller.LoadURL( - kNewURL, content::Referrer(), content::PAGE_TRANSITION_TYPED, - std::string()); + kNewURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(0U, notifications.size()); EXPECT_EQ(-1, controller.GetPendingEntryIndex()); EXPECT_TRUE(controller.GetPendingEntry()); @@ -823,7 +781,7 @@ TEST_F(NavigationControllerTest, LoadURL_RedirectAbortDoesntShowPendingURL) { // Now make a pending new navigation, initiated by the renderer. const GURL kNewURL("http://eh"); NavigationController::LoadURLParams load_url_params(kNewURL); - load_url_params.transition_type = content::PAGE_TRANSITION_TYPED; + load_url_params.transition_type = PAGE_TRANSITION_TYPED; load_url_params.is_renderer_initiated = true; controller.LoadURLWithParams(load_url_params); EXPECT_EQ(0U, notifications.size()); @@ -884,12 +842,10 @@ TEST_F(NavigationControllerTest, Reload) { const GURL url1("http://foo1"); - controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(0U, notifications.size()); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); ASSERT_TRUE(controller.GetActiveEntry()); controller.GetActiveEntry()->SetTitle(ASCIIToUTF16("Title")); controller.Reload(true); @@ -912,8 +868,7 @@ TEST_F(NavigationControllerTest, Reload) { EXPECT_TRUE(controller.GetActiveEntry()->GetTitle().empty()); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // Now the reload is committed. EXPECT_EQ(controller.GetEntryCount(), 1); @@ -938,18 +893,15 @@ TEST_F(NavigationControllerTest, Reload_GeneratesNewPage) { const GURL url1("http://foo1"); const GURL url2("http://foo2"); - controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); controller.Reload(true); EXPECT_EQ(0U, notifications.size()); test_rvh()->SendNavigate(1, url2); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // Now the reload is committed. EXPECT_EQ(controller.GetEntryCount(), 2); @@ -961,9 +913,9 @@ TEST_F(NavigationControllerTest, Reload_GeneratesNewPage) { EXPECT_FALSE(controller.CanGoForward()); } -class TestNavigationObserver : public content::RenderViewHostObserver { +class TestNavigationObserver : public RenderViewHostObserver { public: - TestNavigationObserver(content::RenderViewHost* render_view_host) + TestNavigationObserver(RenderViewHost* render_view_host) : RenderViewHostObserver(render_view_host) { } @@ -990,12 +942,11 @@ TEST_F(NavigationControllerTest, ReloadOriginalRequestURL) { const GURL final_url("http://foo2"); // Load up the original URL, but get redirected. - controller.LoadURL(original_url, content::Referrer(), - content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL( + original_url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(0U, notifications.size()); test_rvh()->SendNavigateWithOriginalRequestURL(0, final_url, original_url); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // The NavigationEntry should save both the original URL and the final // redirected URL. @@ -1024,8 +975,7 @@ TEST_F(NavigationControllerTest, ReloadOriginalRequestURL) { // Send that the navigation has proceeded; say it got redirected again. test_rvh()->SendNavigate(0, final_url); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // Now the reload is committed. EXPECT_EQ(controller.GetEntryCount(), 1); @@ -1045,13 +995,11 @@ TEST_F(NavigationControllerTest, Back) { const GURL url1("http://foo1"); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); const GURL url2("http://foo2"); test_rvh()->SendNavigate(1, url2); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); controller.GoBack(); EXPECT_EQ(0U, notifications.size()); @@ -1071,8 +1019,7 @@ TEST_F(NavigationControllerTest, Back) { controller.GetEntryAtIndex(0)->GetTimestamp()); test_rvh()->SendNavigate(0, url2); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // The back navigation completed successfully. EXPECT_EQ(controller.GetEntryCount(), 2); @@ -1100,16 +1047,14 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) { const GURL url3("http://foo/3"); controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); - controller.LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(1, url2); EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + NOTIFICATION_NAV_ENTRY_COMMITTED)); controller.GoBack(); EXPECT_EQ(0U, notifications.size()); @@ -1124,8 +1069,7 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) { EXPECT_TRUE(controller.CanGoForward()); test_rvh()->SendNavigate(2, url3); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // The back navigation resulted in a completely new navigation. // TODO(darin): perhaps this behavior will be confusing to users? @@ -1150,18 +1094,14 @@ TEST_F(NavigationControllerTest, Back_NewPending) { // First navigate two places so we have some back history. test_rvh()->SendNavigate(0, kUrl1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); - // controller.LoadURL(kUrl2, content::PAGE_TRANSITION_TYPED); + // controller.LoadURL(kUrl2, PAGE_TRANSITION_TYPED); test_rvh()->SendNavigate(1, kUrl2); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // Now start a new pending navigation and go back before it commits. - controller.LoadURL( - kUrl3, content::Referrer(), content::PAGE_TRANSITION_TYPED, - std::string()); + controller.LoadURL(kUrl3, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(-1, controller.GetPendingEntryIndex()); EXPECT_EQ(kUrl3, controller.GetPendingEntry()->GetURL()); controller.GoBack(); @@ -1231,17 +1171,14 @@ TEST_F(NavigationControllerTest, Forward) { const GURL url2("http://foo2"); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); test_rvh()->SendNavigate(1, url2); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); controller.GoBack(); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); controller.GoForward(); @@ -1261,8 +1198,7 @@ TEST_F(NavigationControllerTest, Forward) { controller.GetEntryAtIndex(1)->GetTimestamp()); test_rvh()->SendNavigate(1, url2); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // The forward navigation completed successfully. EXPECT_EQ(controller.GetEntryCount(), 2); @@ -1290,16 +1226,13 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) { const GURL url3("http://foo3"); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); test_rvh()->SendNavigate(1, url2); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); controller.GoBack(); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); controller.GoForward(); EXPECT_EQ(0U, notifications.size()); @@ -1315,8 +1248,8 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) { test_rvh()->SendNavigate(2, url3); EXPECT_TRUE(notifications.Check2AndReset( - content::NOTIFICATION_NAV_LIST_PRUNED, - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + NOTIFICATION_NAV_LIST_PRUNED, + NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(controller.GetEntryCount(), 2); EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 1); @@ -1338,17 +1271,14 @@ TEST_F(NavigationControllerTest, Redirect) { const GURL url2("http://foo2"); // Redirection target // First request - controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(0U, notifications.size()); test_rvh()->SendNavigate(0, url2); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // Second request - controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_TRUE(controller.GetPendingEntry()); EXPECT_EQ(controller.GetPendingEntryIndex(), -1); @@ -1357,7 +1287,7 @@ TEST_F(NavigationControllerTest, Redirect) { ViewHostMsg_FrameNavigate_Params params; params.page_id = 0; params.url = url2; - params.transition = content::PAGE_TRANSITION_SERVER_REDIRECT; + params.transition = PAGE_TRANSITION_SERVER_REDIRECT; params.redirects.push_back(GURL("http://foo1")); params.redirects.push_back(GURL("http://foo2")); params.should_update_history = false; @@ -1365,14 +1295,13 @@ TEST_F(NavigationControllerTest, Redirect) { params.is_post = false; params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2)); - content::LoadCommittedDetails details; + LoadCommittedDetails details; EXPECT_EQ(0U, notifications.size()); EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_TRUE(details.type == content::NAVIGATION_TYPE_SAME_PAGE); + EXPECT_TRUE(details.type == NAVIGATION_TYPE_SAME_PAGE); EXPECT_EQ(controller.GetEntryCount(), 1); EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 0); EXPECT_TRUE(controller.GetLastCommittedEntry()); @@ -1396,18 +1325,15 @@ TEST_F(NavigationControllerTest, PostThenRedirect) { const GURL url2("http://foo2"); // Redirection target // First request as POST - controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); controller.GetActiveEntry()->SetHasPostData(true); EXPECT_EQ(0U, notifications.size()); test_rvh()->SendNavigate(0, url2); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // Second request - controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_TRUE(controller.GetPendingEntry()); EXPECT_EQ(controller.GetPendingEntryIndex(), -1); @@ -1416,7 +1342,7 @@ TEST_F(NavigationControllerTest, PostThenRedirect) { ViewHostMsg_FrameNavigate_Params params; params.page_id = 0; params.url = url2; - params.transition = content::PAGE_TRANSITION_SERVER_REDIRECT; + params.transition = PAGE_TRANSITION_SERVER_REDIRECT; params.redirects.push_back(GURL("http://foo1")); params.redirects.push_back(GURL("http://foo2")); params.should_update_history = false; @@ -1424,14 +1350,13 @@ TEST_F(NavigationControllerTest, PostThenRedirect) { params.is_post = false; params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2)); - content::LoadCommittedDetails details; + LoadCommittedDetails details; EXPECT_EQ(0U, notifications.size()); EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_TRUE(details.type == content::NAVIGATION_TYPE_SAME_PAGE); + EXPECT_TRUE(details.type == NAVIGATION_TYPE_SAME_PAGE); EXPECT_EQ(controller.GetEntryCount(), 1); EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 0); EXPECT_TRUE(controller.GetLastCommittedEntry()); @@ -1454,8 +1379,7 @@ TEST_F(NavigationControllerTest, ImmediateRedirect) { const GURL url2("http://foo2"); // Redirection target // First request - controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_TRUE(controller.GetPendingEntry()); EXPECT_EQ(controller.GetPendingEntryIndex(), -1); @@ -1464,7 +1388,7 @@ TEST_F(NavigationControllerTest, ImmediateRedirect) { ViewHostMsg_FrameNavigate_Params params; params.page_id = 0; params.url = url2; - params.transition = content::PAGE_TRANSITION_SERVER_REDIRECT; + params.transition = PAGE_TRANSITION_SERVER_REDIRECT; params.redirects.push_back(GURL("http://foo1")); params.redirects.push_back(GURL("http://foo2")); params.should_update_history = false; @@ -1472,14 +1396,13 @@ TEST_F(NavigationControllerTest, ImmediateRedirect) { params.is_post = false; params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2)); - content::LoadCommittedDetails details; + LoadCommittedDetails details; EXPECT_EQ(0U, notifications.size()); EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_TRUE(details.type == content::NAVIGATION_TYPE_NEW_PAGE); + EXPECT_TRUE(details.type == NAVIGATION_TYPE_NEW_PAGE); EXPECT_EQ(controller.GetEntryCount(), 1); EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 0); EXPECT_TRUE(controller.GetLastCommittedEntry()); @@ -1500,23 +1423,21 @@ TEST_F(NavigationControllerTest, NewSubframe) { const GURL url1("http://foo1"); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); const GURL url2("http://foo2"); ViewHostMsg_FrameNavigate_Params params; params.page_id = 1; params.url = url2; - params.transition = content::PAGE_TRANSITION_MANUAL_SUBFRAME; + params.transition = PAGE_TRANSITION_MANUAL_SUBFRAME; params.should_update_history = false; params.gesture = NavigationGestureUser; params.is_post = false; params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2)); - content::LoadCommittedDetails details; + LoadCommittedDetails details; EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(url1, details.previous_url); EXPECT_FALSE(details.is_in_page); EXPECT_FALSE(details.is_main_frame); @@ -1543,13 +1464,13 @@ TEST_F(NavigationControllerTest, SubframeOnEmptyPage) { ViewHostMsg_FrameNavigate_Params params; params.page_id = 1; params.url = url; - params.transition = content::PAGE_TRANSITION_AUTO_SUBFRAME; + params.transition = PAGE_TRANSITION_AUTO_SUBFRAME; params.should_update_history = false; params.gesture = NavigationGestureAuto; params.is_post = false; params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url)); - content::LoadCommittedDetails details; + LoadCommittedDetails details; EXPECT_FALSE(controller.RendererDidNavigate(params, &details)); EXPECT_EQ(0U, notifications.size()); } @@ -1563,21 +1484,20 @@ TEST_F(NavigationControllerTest, AutoSubframe) { const GURL url1("http://foo1"); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); const GURL url2("http://foo2"); ViewHostMsg_FrameNavigate_Params params; params.page_id = 0; params.url = url2; - params.transition = content::PAGE_TRANSITION_AUTO_SUBFRAME; + params.transition = PAGE_TRANSITION_AUTO_SUBFRAME; params.should_update_history = false; params.gesture = NavigationGestureUser; params.is_post = false; params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2)); // Navigating should do nothing. - content::LoadCommittedDetails details; + LoadCommittedDetails details; EXPECT_FALSE(controller.RendererDidNavigate(params, &details)); EXPECT_EQ(0U, notifications.size()); @@ -1594,25 +1514,23 @@ TEST_F(NavigationControllerTest, BackSubframe) { // Main page. const GURL url1("http://foo1"); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // First manual subframe navigation. const GURL url2("http://foo2"); ViewHostMsg_FrameNavigate_Params params; params.page_id = 1; params.url = url2; - params.transition = content::PAGE_TRANSITION_MANUAL_SUBFRAME; + params.transition = PAGE_TRANSITION_MANUAL_SUBFRAME; params.should_update_history = false; params.gesture = NavigationGestureUser; params.is_post = false; params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2)); // This should generate a new entry. - content::LoadCommittedDetails details; + LoadCommittedDetails details; EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(2, controller.GetEntryCount()); // Second manual subframe navigation should also make a new entry. @@ -1620,8 +1538,7 @@ TEST_F(NavigationControllerTest, BackSubframe) { params.page_id = 2; params.url = url3; EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(3, controller.GetEntryCount()); EXPECT_EQ(2, controller.GetCurrentEntryIndex()); @@ -1630,8 +1547,7 @@ TEST_F(NavigationControllerTest, BackSubframe) { params.url = url2; params.page_id = 1; EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(3, controller.GetEntryCount()); EXPECT_EQ(1, controller.GetCurrentEntryIndex()); @@ -1640,8 +1556,7 @@ TEST_F(NavigationControllerTest, BackSubframe) { params.url = url1; params.page_id = 0; EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(3, controller.GetEntryCount()); EXPECT_EQ(0, controller.GetCurrentEntryIndex()); } @@ -1655,12 +1570,10 @@ TEST_F(NavigationControllerTest, LinkClick) { const GURL url2("http://foo2"); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); test_rvh()->SendNavigate(1, url2); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // Should not have produced a new session history entry. EXPECT_EQ(controller.GetEntryCount(), 2); @@ -1680,25 +1593,23 @@ TEST_F(NavigationControllerTest, InPage) { // Main page. const GURL url1("http://foo"); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // Ensure main page navigation to same url respects the was_within_same_page // hint provided in the params. ViewHostMsg_FrameNavigate_Params self_params; self_params.page_id = 0; self_params.url = url1; - self_params.transition = content::PAGE_TRANSITION_LINK; + self_params.transition = PAGE_TRANSITION_LINK; self_params.should_update_history = false; self_params.gesture = NavigationGestureUser; self_params.is_post = false; self_params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url1)); self_params.was_within_same_page = true; - content::LoadCommittedDetails details; + LoadCommittedDetails details; EXPECT_TRUE(controller.RendererDidNavigate(self_params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.is_in_page); EXPECT_TRUE(details.did_replace_entry); EXPECT_EQ(1, controller.GetEntryCount()); @@ -1708,7 +1619,7 @@ TEST_F(NavigationControllerTest, InPage) { ViewHostMsg_FrameNavigate_Params params; params.page_id = 1; params.url = url2; - params.transition = content::PAGE_TRANSITION_LINK; + params.transition = PAGE_TRANSITION_LINK; params.should_update_history = false; params.gesture = NavigationGestureUser; params.is_post = false; @@ -1716,8 +1627,7 @@ TEST_F(NavigationControllerTest, InPage) { // This should generate a new entry. EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.is_in_page); EXPECT_FALSE(details.did_replace_entry); EXPECT_EQ(2, controller.GetEntryCount()); @@ -1728,8 +1638,7 @@ TEST_F(NavigationControllerTest, InPage) { back_params.url = url1; back_params.page_id = 0; EXPECT_TRUE(controller.RendererDidNavigate(back_params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // is_in_page is false in that case but should be true. // See comment in AreURLsInPageNavigation() in navigation_controller.cc // EXPECT_TRUE(details.is_in_page); @@ -1743,8 +1652,7 @@ TEST_F(NavigationControllerTest, InPage) { forward_params.url = url2; forward_params.page_id = 1; EXPECT_TRUE(controller.RendererDidNavigate(forward_params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.is_in_page); EXPECT_EQ(2, controller.GetEntryCount()); EXPECT_EQ(1, controller.GetCurrentEntryIndex()); @@ -1768,8 +1676,7 @@ TEST_F(NavigationControllerTest, InPage) { params.url = url3; notifications.Reset(); EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_FALSE(details.is_in_page); EXPECT_EQ(3, controller.GetEntryCount()); EXPECT_EQ(2, controller.GetCurrentEntryIndex()); @@ -1783,25 +1690,23 @@ TEST_F(NavigationControllerTest, InPage_Replace) { // Main page. const GURL url1("http://foo"); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // First navigation. const GURL url2("http://foo#a"); ViewHostMsg_FrameNavigate_Params params; params.page_id = 0; // Same page_id params.url = url2; - params.transition = content::PAGE_TRANSITION_LINK; + params.transition = PAGE_TRANSITION_LINK; params.should_update_history = false; params.gesture = NavigationGestureUser; params.is_post = false; params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url2)); // This should NOT generate a new entry, nor prune the list. - content::LoadCommittedDetails details; + LoadCommittedDetails details; EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.is_in_page); EXPECT_TRUE(details.did_replace_entry); EXPECT_EQ(1, controller.GetEntryCount()); @@ -1822,8 +1727,7 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { { const GURL url("http://foo/"); test_rvh()->SendNavigate(0, url); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); } // Navigate to a new page. @@ -1831,8 +1735,7 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { const GURL url("http://foo2/"); test_rvh()->SendNavigate(1, url); controller.DocumentLoadedInFrame(); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); } // Navigate within the page. @@ -1841,7 +1744,7 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { ViewHostMsg_FrameNavigate_Params params; params.page_id = 1; // Same page_id params.url = url; - params.transition = content::PAGE_TRANSITION_LINK; + params.transition = PAGE_TRANSITION_LINK; params.redirects.push_back(url); params.should_update_history = true; params.gesture = NavigationGestureUnknown; @@ -1849,10 +1752,9 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url)); // This should NOT generate a new entry, nor prune the list. - content::LoadCommittedDetails details; + LoadCommittedDetails details; EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.is_in_page); EXPECT_TRUE(details.did_replace_entry); EXPECT_EQ(2, controller.GetEntryCount()); @@ -1864,7 +1766,7 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { ViewHostMsg_FrameNavigate_Params params; params.page_id = 2; // New page_id params.url = url; - params.transition = content::PAGE_TRANSITION_CLIENT_REDIRECT; + params.transition = PAGE_TRANSITION_CLIENT_REDIRECT; params.redirects.push_back(GURL("http://foo2/#a")); params.redirects.push_back(url); params.should_update_history = true; @@ -1873,10 +1775,9 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url)); // This SHOULD generate a new entry. - content::LoadCommittedDetails details; + LoadCommittedDetails details; EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_FALSE(details.is_in_page); EXPECT_EQ(3, controller.GetEntryCount()); } @@ -1887,27 +1788,27 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { controller.GoBack(); test_rvh()->SendNavigate(1, url); EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_EQ(url, controller.GetActiveEntry()->GetURL()); } } // NotificationObserver implementation used in verifying we've received the -// content::NOTIFICATION_NAV_LIST_PRUNED method. -class PrunedListener : public content::NotificationObserver { +// NOTIFICATION_NAV_LIST_PRUNED method. +class PrunedListener : public NotificationObserver { public: explicit PrunedListener(NavigationControllerImpl* controller) : notification_count_(0) { - registrar_.Add(this, content::NOTIFICATION_NAV_LIST_PRUNED, - content::Source<NavigationController>(controller)); + registrar_.Add(this, NOTIFICATION_NAV_LIST_PRUNED, + Source<NavigationController>(controller)); } virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - if (type == content::NOTIFICATION_NAV_LIST_PRUNED) { + const NotificationSource& source, + const NotificationDetails& details) { + if (type == NOTIFICATION_NAV_LIST_PRUNED) { notification_count_++; - details_ = *(content::Details<content::PrunedDetails>(details).ptr()); + details_ = *(Details<PrunedDetails>(details).ptr()); } } @@ -1915,10 +1816,10 @@ class PrunedListener : public content::NotificationObserver { int notification_count_; // Details from the last NAV_LIST_PRUNED. - content::PrunedDetails details_; + PrunedDetails details_; private: - content::NotificationRegistrar registrar_; + NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(PrunedListener); }; @@ -1936,8 +1837,7 @@ TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { for (url_index = 0; url_index < kMaxEntryCount; url_index++) { GURL url(StringPrintf("http://www.a.com/%d", url_index)); controller.LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, - std::string()); + url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(url_index, url); } @@ -1949,7 +1849,7 @@ TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { // Navigate some more. GURL url(StringPrintf("http://www.a.com/%d", url_index)); controller.LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(url_index, url); url_index++; @@ -1967,8 +1867,7 @@ TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { for (int i = 0; i < 3; i++) { url = GURL(StringPrintf("http:////www.a.com/%d", url_index)); controller.LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, - std::string()); + url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(url_index, url); url_index++; } @@ -1987,8 +1886,8 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { GURL url("http://foo"); std::vector<NavigationEntry*> entries; NavigationEntry* entry = NavigationControllerImpl::CreateNavigationEntry( - url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, - std::string(), browser_context()); + url, Referrer(), PAGE_TRANSITION_RELOAD, false, std::string(), + browser_context()); entry->SetPageID(0); entry->SetTitle(ASCIIToUTF16("Title")); entry->SetContentState("state"); @@ -2034,12 +1933,12 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { ViewHostMsg_FrameNavigate_Params params; params.page_id = 0; params.url = url; - params.transition = content::PAGE_TRANSITION_LINK; + params.transition = PAGE_TRANSITION_LINK; params.should_update_history = false; params.gesture = NavigationGestureUser; params.is_post = false; params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url)); - content::LoadCommittedDetails details; + LoadCommittedDetails details; our_controller.RendererDidNavigate(params, &details); // There should be no longer any pending entry and one committed one. This @@ -2067,8 +1966,8 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { GURL url("http://foo"); std::vector<NavigationEntry*> entries; NavigationEntry* entry = NavigationControllerImpl::CreateNavigationEntry( - url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, - std::string(), browser_context()); + url, Referrer(), PAGE_TRANSITION_RELOAD, false, std::string(), + browser_context()); entry->SetPageID(0); entry->SetTitle(ASCIIToUTF16("Title")); entry->SetContentState("state"); @@ -2121,12 +2020,12 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { ViewHostMsg_FrameNavigate_Params params; params.page_id = 0; params.url = url; - params.transition = content::PAGE_TRANSITION_LINK; + params.transition = PAGE_TRANSITION_LINK; params.should_update_history = false; params.gesture = NavigationGestureUser; params.is_post = false; params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url)); - content::LoadCommittedDetails details; + LoadCommittedDetails details; our_controller.RendererDidNavigate(params, &details); // There should be no pending entry and one committed one. @@ -2148,15 +2047,15 @@ TEST_F(NavigationControllerTest, Interstitial) { // First navigate somewhere normal. const GURL url1("http://foo"); controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(0, url1); // Now navigate somewhere with an interstitial. const GURL url2("http://bar"); controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); NavigationEntryImpl::FromNavigationEntry(controller.GetPendingEntry())-> - set_page_type(content::PAGE_TYPE_INTERSTITIAL); + set_page_type(PAGE_TYPE_INTERSTITIAL); // At this point the interstitial will be displayed and the load will still // be pending. If the user continues, the load will commit. @@ -2164,7 +2063,7 @@ TEST_F(NavigationControllerTest, Interstitial) { // The page should be a normal page again. EXPECT_EQ(url2, controller.GetLastCommittedEntry()->GetURL()); - EXPECT_EQ(content::PAGE_TYPE_NORMAL, + EXPECT_EQ(PAGE_TYPE_NORMAL, controller.GetLastCommittedEntry()->GetPageType()); } @@ -2179,19 +2078,19 @@ TEST_F(NavigationControllerTest, RemoveEntry) { const GURL default_url("http://foo/default"); controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(0, url1); controller.LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(1, url2); controller.LoadURL( - url3, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url3, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(2, url3); controller.LoadURL( - url4, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url4, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(3, url4); controller.LoadURL( - url5, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url5, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(4, url5); // Try to remove the last entry. Will fail because it is the current entry. @@ -2236,10 +2135,10 @@ TEST_F(NavigationControllerTest, TransientEntry) { const GURL transient_url("http://foo/transient"); controller.LoadURL( - url0, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url0, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(0, url0); controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(1, url1); notifications.Reset(); @@ -2265,7 +2164,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { // Navigate. controller.LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(2, url2); // We should have navigated, transient entry should be gone. @@ -2284,7 +2183,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { // Initiate a navigation, add a transient then commit navigation. controller.LoadURL( - url4, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url4, Referrer(), PAGE_TRANSITION_TYPED, std::string()); transient_entry = new NavigationEntryImpl; transient_entry->SetURL(transient_url); controller.AddTransientEntry(transient_entry); @@ -2364,10 +2263,10 @@ TEST_F(NavigationControllerTest, ReloadTransient) { // Load |url0|, and start a pending navigation to |url1|. controller.LoadURL( - url0, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url0, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(0, url0); controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); // A transient entry is added, interrupting the navigation. NavigationEntryImpl* transient_entry = new NavigationEntryImpl; @@ -2406,8 +2305,7 @@ TEST_F(NavigationControllerTest, DontShowRendererURLUntilCommit) { // For typed navigations (browser-initiated), both active and visible entries // should update before commit. - controller.LoadURL(url0, content::Referrer(), - content::PAGE_TRANSITION_TYPED, std::string()); + controller.LoadURL(url0, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(url0, controller.GetActiveEntry()->GetURL()); EXPECT_EQ(url0, controller.GetVisibleEntry()->GetURL()); test_rvh()->SendNavigate(0, url0); @@ -2481,12 +2379,12 @@ TEST_F(NavigationControllerTest, SameSubframe) { ViewHostMsg_FrameNavigate_Params params; params.page_id = 0; params.url = subframe; - params.transition = content::PAGE_TRANSITION_AUTO_SUBFRAME; + params.transition = PAGE_TRANSITION_AUTO_SUBFRAME; params.should_update_history = false; params.gesture = NavigationGestureAuto; params.is_post = false; params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(subframe)); - content::LoadCommittedDetails details; + LoadCommittedDetails details; EXPECT_FALSE(controller.RendererDidNavigate(params, &details)); // Nothing should have changed. @@ -2524,7 +2422,7 @@ TEST_F(NavigationControllerTest, CloneOmitsInterstitials) { // Add an interstitial entry. Should be deleted with controller. NavigationEntryImpl* interstitial_entry = new NavigationEntryImpl(); - interstitial_entry->set_page_type(content::PAGE_TYPE_INTERSTITIAL); + interstitial_entry->set_page_type(PAGE_TYPE_INTERSTITIAL); controller.AddTransientEntry(interstitial_entry); scoped_ptr<WebContents> clone(controller.GetWebContents()->Clone()); @@ -2543,7 +2441,7 @@ TEST_F(NavigationControllerTest, SubframeWhilePending) { // Now start a pending load to a totally different page, but don't commit it. const GURL url2("http://bar/"); controller.LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); // Send a subframe update from the first page, as if one had just // automatically loaded. Auto subframes don't increment the page ID. @@ -2551,12 +2449,12 @@ TEST_F(NavigationControllerTest, SubframeWhilePending) { ViewHostMsg_FrameNavigate_Params params; params.page_id = controller.GetLastCommittedEntry()->GetPageID(); params.url = url1_sub; - params.transition = content::PAGE_TRANSITION_AUTO_SUBFRAME; + params.transition = PAGE_TRANSITION_AUTO_SUBFRAME; params.should_update_history = false; params.gesture = NavigationGestureAuto; params.is_post = false; params.content_state = webkit_glue::CreateHistoryStateForURL(GURL(url1_sub)); - content::LoadCommittedDetails details; + LoadCommittedDetails details; // This should return false meaning that nothing was actually updated. EXPECT_FALSE(controller.RendererDidNavigate(params, &details)); @@ -2726,7 +2624,7 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune3) { static_cast<TestWebContents*>(CreateTestWebContents())); NavigationControllerImpl& other_controller = other_contents->GetController(); other_controller.LoadURL( - url3, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url3, Referrer(), PAGE_TRANSITION_TYPED, std::string()); other_contents->ExpectSetHistoryLengthAndPrune(NULL, 1, -1); other_controller.CopyStateFromAndPrune(&controller); @@ -2926,10 +2824,10 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForTransient) { const GURL transient_url("http://foo/transient"); controller.LoadURL( - url0, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url0, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(0, url0); controller.LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); test_rvh()->SendNavigate(1, url1); // Adding a transient with no pending entry. @@ -2982,8 +2880,7 @@ TEST_F(NavigationControllerTest, IsInitialNavigation) { const GURL url1("http://foo1"); test_rvh()->SendNavigate(0, url1); - EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_NAV_ENTRY_COMMITTED)); + EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); // After commit, it stays false. EXPECT_FALSE(controller.IsInitialNavigation()); @@ -3091,7 +2988,7 @@ class NavigationControllerHistoryTest : public NavigationControllerTest { // db matches. TEST_F(NavigationControllerHistoryTest, Basic) { NavigationControllerImpl& controller = controller_impl(); - controller.LoadURL(url0, GURL(), content::PAGE_TRANSITION_LINK); + controller.LoadURL(url0, GURL(), PAGE_TRANSITION_LINK); test_rvh()->SendNavigate(0, url0); GetLastSession(); @@ -3100,7 +2997,7 @@ TEST_F(NavigationControllerHistoryTest, Basic) { session_helper_.AssertTabEquals(0, 0, 1, *(windows_[0]->tabs[0])); TabNavigation nav1(0, url0, GURL(), string16(), webkit_glue::CreateHistoryStateForURL(url0), - content::PAGE_TRANSITION_LINK); + PAGE_TRANSITION_LINK); session_helper_.AssertNavigationEquals(nav1, windows_[0]->tabs[0]->navigations[0]); } @@ -3123,7 +3020,7 @@ TEST_F(NavigationControllerHistoryTest, NavigationThenBack) { TabNavigation nav(0, url0, GURL(), string16(), webkit_glue::CreateHistoryStateForURL(url0), - content::PAGE_TRANSITION_LINK); + PAGE_TRANSITION_LINK); session_helper_.AssertNavigationEquals(nav, windows_[0]->tabs[0]->navigations[0]); nav.set_url(url1); @@ -3158,7 +3055,7 @@ TEST_F(NavigationControllerHistoryTest, NavigationPruning) { TabNavigation nav(0, url0, GURL(), string16(), webkit_glue::CreateHistoryStateForURL(url0), - content::PAGE_TRANSITION_LINK); + PAGE_TRANSITION_LINK); session_helper_.AssertNavigationEquals(nav, windows_[0]->tabs[0]->navigations[0]); nav.set_url(url2); @@ -3166,3 +3063,5 @@ TEST_F(NavigationControllerHistoryTest, NavigationPruning) { windows_[0]->tabs[0]->navigations[1]); } */ + +} // namespace content diff --git a/content/browser/web_contents/render_view_host_manager.cc b/content/browser/web_contents/render_view_host_manager.cc index 0415049..b57f08d 100644 --- a/content/browser/web_contents/render_view_host_manager.cc +++ b/content/browser/web_contents/render_view_host_manager.cc @@ -28,6 +28,7 @@ #include "content/public/common/url_constants.h" using content::NavigationController; +using content::NavigationControllerImpl; using content::NavigationEntry; using content::NavigationEntryImpl; using content::RenderProcessHost; diff --git a/content/browser/web_contents/render_view_host_manager.h b/content/browser/web_contents/render_view_host_manager.h index 13bcb78..ab7a7c8 100644 --- a/content/browser/web_contents/render_view_host_manager.h +++ b/content/browser/web_contents/render_view_host_manager.h @@ -15,16 +15,17 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" -class InterstitialPageImpl; -class NavigationControllerImpl; class WebUIImpl; namespace content { class BrowserContext; +class InterstitialPageImpl; +class NavigationControllerImpl; class NavigationEntry; class NavigationEntryImpl; class RenderViewHost; class RenderViewHostImpl; +class RenderViewHostManagerTest; class RenderWidgetHostDelegate; class RenderWidgetHostView; class TestWebContents; @@ -65,7 +66,8 @@ class CONTENT_EXPORT RenderViewHostManager content::RenderViewHost* render_view_host) = 0; virtual void UpdateRenderViewSizeForRenderManager() = 0; virtual void NotifySwappedFromRenderManager() = 0; - virtual NavigationControllerImpl& GetControllerForRenderManager() = 0; + virtual content::NavigationControllerImpl& + GetControllerForRenderManager() = 0; // Create swapped out RenderViews in the given SiteInstance for each tab in // the opener chain of this tab, if any. This allows the current tab to @@ -186,7 +188,7 @@ class CONTENT_EXPORT RenderViewHostManager // |interstitial_page| should be non NULL (use the remove_interstitial_page // method to unset the interstitial) and no interstitial page should be set // when there is already a non NULL interstitial page set. - void set_interstitial_page(InterstitialPageImpl* interstitial_page) { + void set_interstitial_page(content::InterstitialPageImpl* interstitial_page) { DCHECK(!interstitial_page_ && interstitial_page); interstitial_page_ = interstitial_page; } @@ -199,7 +201,7 @@ class CONTENT_EXPORT RenderViewHostManager // Returns the currently showing interstitial, NULL if no interstitial is // showing. - InterstitialPageImpl* interstitial_page() const { + content::InterstitialPageImpl* interstitial_page() const { return interstitial_page_; } @@ -228,8 +230,8 @@ class CONTENT_EXPORT RenderViewHostManager content::SiteInstance* instance); private: + friend class content::RenderViewHostManagerTest; friend class content::TestWebContents; - friend class RenderViewHostManagerTest; // Returns whether this tab should transition to a new renderer for // cross-site URLs. Enabled unless we see the --process-per-tab command line @@ -320,7 +322,7 @@ class CONTENT_EXPORT RenderViewHostManager // The intersitial page currently shown if any, not own by this class // (the InterstitialPage is self-owned, it deletes itself when hidden). - InterstitialPageImpl* interstitial_page_; + content::InterstitialPageImpl* interstitial_page_; content::NotificationRegistrar registrar_; diff --git a/content/browser/web_contents/render_view_host_manager_unittest.cc b/content/browser/web_contents/render_view_host_manager_unittest.cc index ee8ee84..a1d5bb3 100644 --- a/content/browser/web_contents/render_view_host_manager_unittest.cc +++ b/content/browser/web_contents/render_view_host_manager_unittest.cc @@ -29,27 +29,11 @@ #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/glue_serialize.h" -using content::BrowserContext; -using content::BrowserThread; -using content::BrowserThreadImpl; -using content::MockRenderProcessHost; -using content::NavigationController; -using content::NavigationEntry; -using content::NavigationEntryImpl; -using content::RenderViewHost; -using content::RenderViewHostImpl; -using content::RenderViewHostImplTestHarness; -using content::SiteInstance; -using content::TestRenderViewHost; -using content::TestWebContents; -using content::WebContents; -using content::WebUI; -using content::WebUIController; - +namespace content { namespace { class RenderViewHostManagerTestWebUIControllerFactory - : public content::WebUIControllerFactory { + : public WebUIControllerFactory { public: RenderViewHostManagerTestWebUIControllerFactory() : should_create_webui_(false) { @@ -63,8 +47,7 @@ class RenderViewHostManagerTestWebUIControllerFactory // WebUIFactory implementation. virtual WebUIController* CreateWebUIControllerForURL( WebUI* web_ui, const GURL& url) const OVERRIDE { - if (!(should_create_webui_ && - content::GetContentClient()->HasWebUIScheme(url))) + if (!(should_create_webui_ && GetContentClient()->HasWebUIScheme(url))) return NULL; return new WebUIController(web_ui); } @@ -76,19 +59,19 @@ class RenderViewHostManagerTestWebUIControllerFactory virtual bool UseWebUIForURL(BrowserContext* browser_context, const GURL& url) const OVERRIDE { - return content::GetContentClient()->HasWebUIScheme(url); + return GetContentClient()->HasWebUIScheme(url); } virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, const GURL& url) const OVERRIDE { - return content::GetContentClient()->HasWebUIScheme(url); + return GetContentClient()->HasWebUIScheme(url); } virtual bool IsURLAcceptableForWebUI( BrowserContext* browser_context, const GURL& url, bool data_urls_allowed) const OVERRIDE { - return content::GetContentClient()->HasWebUIScheme(url); + return GetContentClient()->HasWebUIScheme(url); } private: @@ -108,7 +91,7 @@ class RenderViewHostManagerTestClient : public TestContentClient { }; class RenderViewHostManagerTestBrowserClient - : public content::TestContentBrowserClient { + : public TestContentBrowserClient { public: RenderViewHostManagerTestBrowserClient() {} virtual ~RenderViewHostManagerTestBrowserClient() {} @@ -117,8 +100,8 @@ class RenderViewHostManagerTestBrowserClient factory_.set_should_create_webui(should_create_webui); } - // content::TestContentBrowserClient implementation. - virtual content::WebUIControllerFactory* + // TestContentBrowserClient implementation. + virtual WebUIControllerFactory* GetWebUIControllerFactory() OVERRIDE { return &factory_; } @@ -136,17 +119,17 @@ class RenderViewHostManagerTest public: virtual void SetUp() OVERRIDE { RenderViewHostImplTestHarness::SetUp(); - old_client_ = content::GetContentClient(); - old_browser_client_ = content::GetContentClient()->browser(); - content::SetContentClient(&client_); - content::GetContentClient()->set_browser_for_testing(&browser_client_); + old_client_ = GetContentClient(); + old_browser_client_ = GetContentClient()->browser(); + SetContentClient(&client_); + GetContentClient()->set_browser_for_testing(&browser_client_); url_util::AddStandardScheme(chrome::kChromeUIScheme); } virtual void TearDown() OVERRIDE { RenderViewHostImplTestHarness::TearDown(); - content::GetContentClient()->set_browser_for_testing(old_browser_client_); - content::SetContentClient(old_client_); + GetContentClient()->set_browser_for_testing(old_browser_client_); + SetContentClient(old_client_); } void set_should_create_webui(bool should_create_webui) { @@ -157,8 +140,7 @@ class RenderViewHostManagerTest // Note: we navigate the active RenderViewHost because previous navigations // won't have committed yet, so NavigateAndCommit does the wrong thing // for us. - controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); + controller().LoadURL(url, Referrer(), PAGE_TRANSITION_LINK, std::string()); TestRenderViewHost* old_rvh = test_rvh(); // Simulate the ShouldClose_ACK that is received from the current renderer @@ -186,8 +168,8 @@ class RenderViewHostManagerTest private: RenderViewHostManagerTestClient client_; RenderViewHostManagerTestBrowserClient browser_client_; - content::ContentClient* old_client_; - content::ContentBrowserClient* old_browser_client_; + ContentClient* old_client_; + ContentBrowserClient* old_browser_client_; }; // Tests that when you navigate from a chrome:// url to another page, and @@ -211,8 +193,7 @@ TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) { // a RVH that's not pending (since there is no cross-site transition), so // we use the committed one. contents2->GetController().LoadURL( - kChromeUrl, content::Referrer(), content::PAGE_TRANSITION_LINK, - std::string()); + kChromeUrl, Referrer(), PAGE_TRANSITION_LINK, std::string()); TestRenderViewHost* ntp_rvh2 = static_cast<TestRenderViewHost*>( contents2->GetRenderManagerForTesting()->current_host()); EXPECT_FALSE(contents2->cross_navigation_pending()); @@ -221,8 +202,7 @@ TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) { // The second one is the opposite, creating a cross-site transition and // requiring a beforeunload ack. contents2->GetController().LoadURL( - kDestUrl, content::Referrer(), content::PAGE_TRANSITION_LINK, - std::string()); + kDestUrl, Referrer(), PAGE_TRANSITION_LINK, std::string()); EXPECT_TRUE(contents2->cross_navigation_pending()); TestRenderViewHost* dest_rvh2 = static_cast<TestRenderViewHost*>( contents2->GetRenderManagerForTesting()->pending_render_view_host()); @@ -242,8 +222,7 @@ TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) { NavigateActiveAndCommit(kChromeUrl); contents2->GetController().LoadURL( - kChromeUrl, content::Referrer(), content::PAGE_TRANSITION_LINK, - std::string()); + kChromeUrl, Referrer(), PAGE_TRANSITION_LINK, std::string()); dest_rvh2->SendShouldCloseACK(true); static_cast<TestRenderViewHost*>(contents2->GetRenderManagerForTesting()-> pending_render_view_host())->SendNavigate(102, kChromeUrl); @@ -279,8 +258,7 @@ TEST_F(RenderViewHostManagerTest, FilterMessagesWhileSwappedOut) { // Navigate to a cross-site URL. contents()->GetController().LoadURL( - kDestUrl, content::Referrer(), content::PAGE_TRANSITION_LINK, - std::string()); + kDestUrl, Referrer(), PAGE_TRANSITION_LINK, std::string()); EXPECT_TRUE(contents()->cross_navigation_pending()); TestRenderViewHost* dest_rvh = static_cast<TestRenderViewHost*>( contents()->GetRenderManagerForTesting()->pending_render_view_host()); @@ -328,7 +306,7 @@ TEST_F(RenderViewHostManagerTest, FilterMessagesWhileSwappedOut) { ntp_process_host->sink().ClearMessages(); ViewHostMsg_RunJavaScriptMessage js_msg( rvh()->GetRoutingID(), msg, msg, kChromeURL, - content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, &result, &unused); + JAVASCRIPT_MESSAGE_TYPE_CONFIRM, &result, &unused); js_msg.EnableMessagePumping(); EXPECT_TRUE(ntp_rvh->OnMessageReceived(js_msg)); EXPECT_TRUE(ntp_process_host->sink().GetUniqueMessageMatching(IPC_REPLY_ID)); @@ -353,7 +331,7 @@ TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) { // Navigate. controller().LoadURL( - kUrl, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + kUrl, Referrer(), PAGE_TRANSITION_TYPED, std::string()); // Simulate response from RenderView for FirePageBeforeUnload. test_rvh()->OnMessageReceived(ViewHostMsg_ShouldClose_ACK( rvh()->GetRoutingID(), true, base::TimeTicks(), base::TimeTicks())); @@ -374,7 +352,7 @@ TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) { process()->sink().ClearMessages(); // Navigate, again. controller().LoadURL( - kUrl, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + kUrl, Referrer(), PAGE_TRANSITION_TYPED, std::string()); // The same RenderViewHost should be reused. EXPECT_FALSE(pending_rvh()); EXPECT_TRUE(last_rvh == rvh()); @@ -411,16 +389,15 @@ TEST_F(RenderViewHostManagerTest, Init) { // Tests the Navigate function. We navigate three sites consecutively and check // how the pending/committed RenderViewHost are modified. TEST_F(RenderViewHostManagerTest, Navigate) { - content::TestNotificationTracker notifications; + TestNotificationTracker notifications; SiteInstance* instance = SiteInstance::Create(browser_context()); scoped_ptr<TestWebContents> web_contents( TestWebContents::Create(browser_context(), instance)); notifications.ListenFor( - content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, - content::Source<NavigationController>( - &web_contents->GetController())); + NOTIFICATION_RENDER_VIEW_HOST_CHANGED, + Source<NavigationController>(&web_contents->GetController())); // Create. RenderViewHostManager manager(web_contents.get(), web_contents.get(), @@ -433,8 +410,8 @@ TEST_F(RenderViewHostManagerTest, Navigate) { // 1) The first navigation. -------------------------- const GURL kUrl1("http://www.google.com/"); NavigationEntryImpl entry1( - NULL /* instance */, -1 /* page_id */, kUrl1, content::Referrer(), - string16() /* title */, content::PAGE_TRANSITION_TYPED, + NULL /* instance */, -1 /* page_id */, kUrl1, Referrer(), + string16() /* title */, PAGE_TRANSITION_TYPED, false /* is_renderer_init */); host = manager.Navigate(entry1); @@ -455,8 +432,8 @@ TEST_F(RenderViewHostManagerTest, Navigate) { const GURL kUrl2("http://www.google.com/foo"); NavigationEntryImpl entry2( NULL /* instance */, -1 /* page_id */, kUrl2, - content::Referrer(kUrl1, WebKit::WebReferrerPolicyDefault), - string16() /* title */, content::PAGE_TRANSITION_LINK, + Referrer(kUrl1, WebKit::WebReferrerPolicyDefault), + string16() /* title */, PAGE_TRANSITION_LINK, true /* is_renderer_init */); host = manager.Navigate(entry2); @@ -475,8 +452,8 @@ TEST_F(RenderViewHostManagerTest, Navigate) { const GURL kUrl3("http://webkit.org/"); NavigationEntryImpl entry3( NULL /* instance */, -1 /* page_id */, kUrl3, - content::Referrer(kUrl2, WebKit::WebReferrerPolicyDefault), - string16() /* title */, content::PAGE_TRANSITION_LINK, + Referrer(kUrl2, WebKit::WebReferrerPolicyDefault), + string16() /* title */, PAGE_TRANSITION_LINK, false /* is_renderer_init */); host = manager.Navigate(entry3); @@ -497,7 +474,7 @@ TEST_F(RenderViewHostManagerTest, Navigate) { // We should observe a notification. EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED)); + NOTIFICATION_RENDER_VIEW_HOST_CHANGED)); } // Tests the Navigate function. In this unit test we verify that the Navigate @@ -505,16 +482,15 @@ TEST_F(RenderViewHostManagerTest, Navigate) { // has been committed. This is also a regression test for // http://crbug.com/104600. TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) { - content::TestNotificationTracker notifications; + TestNotificationTracker notifications; SiteInstance* instance = SiteInstance::Create(browser_context()); scoped_ptr<TestWebContents> web_contents( TestWebContents::Create(browser_context(), instance)); notifications.ListenFor( - content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, - content::Source<NavigationController>( - &web_contents->GetController())); + NOTIFICATION_RENDER_VIEW_HOST_CHANGED, + Source<NavigationController>(&web_contents->GetController())); // Create. RenderViewHostManager manager(web_contents.get(), web_contents.get(), @@ -525,8 +501,8 @@ TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) { // 1) The first navigation. -------------------------- const GURL kUrl1("http://www.google.com/"); NavigationEntryImpl entry1(NULL /* instance */, -1 /* page_id */, kUrl1, - content::Referrer(), string16() /* title */, - content::PAGE_TRANSITION_TYPED, + Referrer(), string16() /* title */, + PAGE_TRANSITION_TYPED, false /* is_renderer_init */); RenderViewHost* host = manager.Navigate(entry1); @@ -536,7 +512,7 @@ TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) { // We should observe a notification. EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED)); + NOTIFICATION_RENDER_VIEW_HOST_CHANGED)); notifications.Reset(); // Commit. @@ -552,8 +528,8 @@ TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) { // 2) Cross-site navigate to next site. ------------------------- const GURL kUrl2("http://www.example.com"); NavigationEntryImpl entry2( - NULL /* instance */, -1 /* page_id */, kUrl2, content::Referrer(), - string16() /* title */, content::PAGE_TRANSITION_TYPED, + NULL /* instance */, -1 /* page_id */, kUrl2, Referrer(), + string16() /* title */, PAGE_TRANSITION_TYPED, false /* is_renderer_init */); RenderViewHostImpl* host2 = static_cast<RenderViewHostImpl*>( manager.Navigate(entry2)); @@ -605,8 +581,8 @@ TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) { // 3) Cross-site navigate to next site before 2) has committed. -------------- const GURL kUrl3("http://webkit.org/"); NavigationEntryImpl entry3(NULL /* instance */, -1 /* page_id */, kUrl3, - content::Referrer(), string16() /* title */, - content::PAGE_TRANSITION_TYPED, + Referrer(), string16() /* title */, + PAGE_TRANSITION_TYPED, false /* is_renderer_init */); test_process_host->sink().ClearMessages(); RenderViewHost* host3 = manager.Navigate(entry3); @@ -653,7 +629,7 @@ TEST_F(RenderViewHostManagerTest, NavigateWithEarlyReNavigation) { // We should observe a notification. EXPECT_TRUE(notifications.Check1AndReset( - content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED)); + NOTIFICATION_RENDER_VIEW_HOST_CHANGED)); } // Tests WebUI creation. @@ -671,8 +647,8 @@ TEST_F(RenderViewHostManagerTest, WebUI) { const GURL kUrl("chrome://foo"); NavigationEntryImpl entry(NULL /* instance */, -1 /* page_id */, kUrl, - content::Referrer(), string16() /* title */, - content::PAGE_TRANSITION_TYPED, + Referrer(), string16() /* title */, + PAGE_TRANSITION_TYPED, false /* is_renderer_init */); RenderViewHost* host = manager.Navigate(entry); @@ -695,7 +671,7 @@ TEST_F(RenderViewHostManagerTest, WebUI) { // Commit. manager.DidNavigateMainFrame(host); - EXPECT_TRUE(host->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI); + EXPECT_TRUE(host->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); } // Tests that we don't end up in an inconsistent state if a page does a back and @@ -724,7 +700,7 @@ TEST_F(RenderViewHostManagerTest, PageDoesBackAndReload) { ViewHostMsg_FrameNavigate_Params params; params.page_id = 1; params.url = kUrl2; - params.transition = content::PAGE_TRANSITION_CLIENT_REDIRECT; + params.transition = PAGE_TRANSITION_CLIENT_REDIRECT; params.should_update_history = false; params.gesture = NavigationGestureAuto; params.was_within_same_page = false; @@ -863,7 +839,7 @@ TEST_F(RenderViewHostManagerTest, EnableWebUIWithSwappedOutOpener) { // Ensure the RVH has WebUI bindings. TestRenderViewHost* rvh1 = test_rvh(); - EXPECT_TRUE(rvh1->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI); + EXPECT_TRUE(rvh1->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); // Create a new tab and simulate it being the opener for the main // tab. It should be in the same SiteInstance. @@ -888,12 +864,12 @@ TEST_F(RenderViewHostManagerTest, EnableWebUIWithSwappedOutOpener) { EXPECT_TRUE(opener1_rvh->is_swapped_out()); // Ensure the new RVH has WebUI bindings. - EXPECT_TRUE(rvh2->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI); + EXPECT_TRUE(rvh2->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); } // Test that we reuse the same guest SiteInstance if we navigate across sites. TEST_F(RenderViewHostManagerTest, NoSwapOnGuestNavigations) { - content::TestNotificationTracker notifications; + TestNotificationTracker notifications; GURL guest_url("guest://abc123"); SiteInstance* instance = @@ -912,8 +888,8 @@ TEST_F(RenderViewHostManagerTest, NoSwapOnGuestNavigations) { // 1) The first navigation. -------------------------- const GURL kUrl1("http://www.google.com/"); NavigationEntryImpl entry1( - NULL /* instance */, -1 /* page_id */, kUrl1, content::Referrer(), - string16() /* title */, content::PAGE_TRANSITION_TYPED, + NULL /* instance */, -1 /* page_id */, kUrl1, Referrer(), + string16() /* title */, PAGE_TRANSITION_TYPED, false /* is_renderer_init */); host = manager.Navigate(entry1); @@ -935,8 +911,8 @@ TEST_F(RenderViewHostManagerTest, NoSwapOnGuestNavigations) { const GURL kUrl2("http://www.chromium.org"); NavigationEntryImpl entry2( NULL /* instance */, -1 /* page_id */, kUrl2, - content::Referrer(kUrl1, WebKit::WebReferrerPolicyDefault), - string16() /* title */, content::PAGE_TRANSITION_LINK, + Referrer(kUrl1, WebKit::WebReferrerPolicyDefault), + string16() /* title */, PAGE_TRANSITION_LINK, true /* is_renderer_init */); host = manager.Navigate(entry2); @@ -950,5 +926,6 @@ TEST_F(RenderViewHostManagerTest, NoSwapOnGuestNavigations) { ASSERT_TRUE(host); EXPECT_EQ(static_cast<SiteInstanceImpl*>(host->GetSiteInstance()), instance); - } + +} // namespace content diff --git a/content/browser/web_contents/web_contents_delegate_unittest.cc b/content/browser/web_contents/web_contents_delegate_unittest.cc index 6122d54..1ba4118 100644 --- a/content/browser/web_contents/web_contents_delegate_unittest.cc +++ b/content/browser/web_contents/web_contents_delegate_unittest.cc @@ -13,25 +13,24 @@ #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" -namespace { +namespace content { -class MockWebContentsDelegate : public content::WebContentsDelegate { +class MockWebContentsDelegate : public WebContentsDelegate { public: virtual ~MockWebContentsDelegate() {} }; -class WebContentsDelegateTest : - public content::RenderViewHostImplTestHarness { +class WebContentsDelegateTest : public RenderViewHostImplTestHarness { public: WebContentsDelegateTest() : file_user_blocking_thread_( - content::BrowserThread::FILE_USER_BLOCKING, &message_loop_), - io_thread_(content::BrowserThread::IO, &message_loop_) { + BrowserThread::FILE_USER_BLOCKING, &message_loop_), + io_thread_(BrowserThread::IO, &message_loop_) { } private: - content::TestBrowserThread file_user_blocking_thread_; - content::TestBrowserThread io_thread_; + TestBrowserThread file_user_blocking_thread_; + TestBrowserThread io_thread_; }; TEST_F(WebContentsDelegateTest, UnregisterInDestructor) { @@ -80,4 +79,4 @@ TEST_F(WebContentsDelegateTest, UnregisterInDestructor) { contents_b.reset(); } -} // namespace +} // namespace content diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index c09ad4d..54f7682 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -135,43 +135,9 @@ // the user goes back. The process only stays live if another tab is using // it, but if so, the existing frame relationships will be maintained. -using content::BrowserContext; -using content::DevToolsAgentHost; -using content::DevToolsAgentHostRegistry; -using content::DevToolsManagerImpl; -using content::DownloadItem; -using content::DownloadManager; -using content::DownloadUrlParameters; -using content::GlobalRequestID; -using content::HostZoomMap; -using content::InterstitialPage; -using content::LoadNotificationDetails; -using content::NativeWebKeyboardEvent; -using content::NavigationController; -using content::NavigationEntry; -using content::NavigationEntryImpl; -using content::OpenURLParams; -using content::RenderViewHost; -using content::RenderViewHostDelegate; -using content::RenderViewHostDelegateView; -using content::RenderViewHostImpl; -using content::RenderWidgetHost; -using content::RenderWidgetHostImpl; -using content::RenderWidgetHostView; -using content::RenderWidgetHostViewPort; -using content::ResourceDispatcherHostImpl; -using content::SSLStatus; -using content::SessionStorageNamespace; -using content::SiteInstance; -using content::UserMetricsAction; -using content::WebContents; -using content::WebContentsDelegate; -using content::WebContentsObserver; -using content::WebUI; -using content::WebUIController; -using content::WebUIControllerFactory; using webkit_glue::WebPreferences; +namespace content { namespace { // Amount of time we wait between when a key event is received and the renderer @@ -193,7 +159,7 @@ BOOL CALLBACK InvalidateWindow(HWND hwnd, LPARAM lparam) { #endif ViewMsg_Navigate_Type::Value GetNavigationType( - content::BrowserContext* browser_context, const NavigationEntryImpl& entry, + BrowserContext* browser_context, const NavigationEntryImpl& entry, NavigationController::ReloadType reload_type) { switch (reload_type) { case NavigationControllerImpl::RELOAD: @@ -220,7 +186,7 @@ ViewMsg_Navigate_Type::Value GetNavigationType( void MakeNavigateParams(const NavigationEntryImpl& entry, const NavigationControllerImpl& controller, - content::WebContentsDelegate* delegate, + WebContentsDelegate* delegate, NavigationController::ReloadType reload_type, const std::string& embedder_channel_name, int embedder_container_id, @@ -289,8 +255,6 @@ int GetSwitchValueAsInt( } // namespace -namespace content { - WebContents* WebContents::Create( BrowserContext* browser_context, SiteInstance* site_instance, @@ -326,12 +290,10 @@ WebContents* WebContents::FromRenderViewHost(const RenderViewHost* rvh) { return rvh->GetDelegate()->GetAsWebContents(); } -} - // WebContentsImpl ------------------------------------------------------------- WebContentsImpl::WebContentsImpl( - content::BrowserContext* browser_context, + BrowserContext* browser_context, WebContentsImpl* opener) : delegate_(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(controller_(this, browser_context)), @@ -356,10 +318,8 @@ WebContentsImpl::WebContentsImpl( is_showing_before_unload_dialog_(false), opener_web_ui_type_(WebUI::kNoWebUI), closed_by_user_gesture_(false), - minimum_zoom_percent_( - static_cast<int>(content::kMinimumZoomFactor * 100)), - maximum_zoom_percent_( - static_cast<int>(content::kMaximumZoomFactor * 100)), + minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), + maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), temporary_zoom_settings_(false), content_restrictions_(0), color_chooser_(NULL) { @@ -384,10 +344,10 @@ WebContentsImpl::~WebContentsImpl() { NotifyDisconnected(); // Notify any observer that have a reference on this WebContents. - content::NotificationService::current()->Notify( - content::NOTIFICATION_WEB_CONTENTS_DESTROYED, - content::Source<WebContents>(this), - content::NotificationService::NoDetails()); + NotificationService::current()->Notify( + NOTIFICATION_WEB_CONTENTS_DESTROYED, + Source<WebContents>(this), + NotificationService::NoDetails()); // TODO(brettw) this should be moved to the view. #if defined(OS_WIN) && !defined(USE_AURA) @@ -460,7 +420,7 @@ WebContentsImpl* WebContentsImpl::CreateGuest(BrowserContext* browser_context, // This makes |new_contents| act as a guest. // For more info, see comment above class BrowserPluginGuest. new_contents_impl->browser_plugin_guest_.reset( - content::BrowserPluginGuest::Create( + BrowserPluginGuest::Create( guest_instance_id, new_contents_impl, new_contents_impl->GetRenderViewHost())); @@ -607,23 +567,23 @@ WebPreferences WebContentsImpl::GetWebkitPrefs(RenderViewHost* rvh, GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); DCHECK(gpu_data_manager); uint32 blacklist_type = gpu_data_manager->GetBlacklistedFeatures(); - if (blacklist_type & content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) + if (blacklist_type & GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) prefs.accelerated_compositing_enabled = false; - if (blacklist_type & content::GPU_FEATURE_TYPE_WEBGL) + if (blacklist_type & GPU_FEATURE_TYPE_WEBGL) prefs.experimental_webgl_enabled = false; - if (blacklist_type & content::GPU_FEATURE_TYPE_FLASH3D) + if (blacklist_type & GPU_FEATURE_TYPE_FLASH3D) prefs.flash_3d_enabled = false; - if (blacklist_type & content::GPU_FEATURE_TYPE_FLASH_STAGE3D) + if (blacklist_type & GPU_FEATURE_TYPE_FLASH_STAGE3D) prefs.flash_stage3d_enabled = false; - if (blacklist_type & content::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) + if (blacklist_type & GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) prefs.accelerated_2d_canvas_enabled = false; - if (blacklist_type & content::GPU_FEATURE_TYPE_MULTISAMPLING) + if (blacklist_type & GPU_FEATURE_TYPE_MULTISAMPLING) prefs.gl_multisampling_enabled = false; - if (blacklist_type & content::GPU_FEATURE_TYPE_3D_CSS) { + if (blacklist_type & GPU_FEATURE_TYPE_3D_CSS) { prefs.accelerated_layers_enabled = false; prefs.accelerated_animation_enabled = false; } - if (blacklist_type & content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO) + if (blacklist_type & GPU_FEATURE_TYPE_ACCELERATED_VIDEO) prefs.accelerated_video_enabled = false; // Accelerated video and animation are slower than regular when using a @@ -686,7 +646,7 @@ WebPreferences WebContentsImpl::GetWebkitPrefs(RenderViewHost* rvh, prefs.apply_page_scale_factor_in_compositor = command_line.HasSwitch(cc::switches::kEnablePinchInCompositor); - content::GetContentClient()->browser()->OverrideWebkitPrefs(rvh, url, &prefs); + GetContentClient()->browser()->OverrideWebkitPrefs(rvh, url, &prefs); // Disable compositing in guests until we have compositing path implemented // for guests. @@ -767,7 +727,7 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, message_source_ = NULL; if (!message_is_ok) { - content::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); + RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); GetRenderProcessHost()->ReceivedBadMessage(); } @@ -776,7 +736,7 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, void WebContentsImpl::RunFileChooser( RenderViewHost* render_view_host, - const content::FileChooserParams& params) { + const FileChooserParams& params) { if (delegate_) delegate_->RunFileChooser(this, params); } @@ -789,7 +749,7 @@ const NavigationControllerImpl& WebContentsImpl::GetController() const { return controller_; } -content::BrowserContext* WebContentsImpl::GetBrowserContext() const { +BrowserContext* WebContentsImpl::GetBrowserContext() const { return controller_.GetBrowserContext(); } @@ -799,11 +759,11 @@ const GURL& WebContentsImpl::GetURL() const { return entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); } -content::WebContentsDelegate* WebContentsImpl::GetDelegate() { +WebContentsDelegate* WebContentsImpl::GetDelegate() { return delegate_; } -void WebContentsImpl::SetDelegate(content::WebContentsDelegate* delegate) { +void WebContentsImpl::SetDelegate(WebContentsDelegate* delegate) { // TODO(cbentzel): remove this debugging code? if (delegate == delegate_) return; @@ -814,7 +774,7 @@ void WebContentsImpl::SetDelegate(content::WebContentsDelegate* delegate) { delegate_->Attach(this); } -content::RenderProcessHost* WebContentsImpl::GetRenderProcessHost() const { +RenderProcessHost* WebContentsImpl::GetRenderProcessHost() const { RenderViewHostImpl* host = render_manager_.current_host(); return host ? host->GetProcess() : NULL; } @@ -834,13 +794,13 @@ RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() const { return render_manager_.GetRenderWidgetHostView(); } -content::WebContentsView* WebContentsImpl::GetView() const { +WebContentsView* WebContentsImpl::GetView() const { return view_.get(); } -content::WebUI* WebContentsImpl::CreateWebUI(const GURL& url) { +WebUI* WebContentsImpl::CreateWebUI(const GURL& url) { WebUIControllerFactory* factory = - content::GetContentClient()->browser()->GetWebUIControllerFactory(); + GetContentClient()->browser()->GetWebUIControllerFactory(); if (!factory) return NULL; WebUIImpl* web_ui = new WebUIImpl(this); @@ -855,12 +815,12 @@ content::WebUI* WebContentsImpl::CreateWebUI(const GURL& url) { return NULL; } -content::WebUI* WebContentsImpl::GetWebUI() const { +WebUI* WebContentsImpl::GetWebUI() const { return render_manager_.web_ui() ? render_manager_.web_ui() : render_manager_.pending_web_ui(); } -content::WebUI* WebContentsImpl::GetCommittedWebUI() const { +WebUI* WebContentsImpl::GetCommittedWebUI() const { return render_manager_.web_ui(); } @@ -894,7 +854,7 @@ const string16& WebContentsImpl::GetTitle() const { // that are shown on top of existing pages. NavigationEntry* entry = controller_.GetTransientEntry(); std::string accept_languages = - content::GetContentClient()->browser()->GetAcceptLangs( + GetContentClient()->browser()->GetAcceptLangs( GetBrowserContext()); if (entry) { return entry->GetTitleForDisplay(accept_languages); @@ -1012,7 +972,7 @@ void WebContentsImpl::SetIsCrashed(base::TerminationStatus status, crashed_status_ = status; crashed_error_code_ = error_code; - NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TAB); + NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); } base::TerminationStatus WebContentsImpl::GetCrashedStatus() const { @@ -1056,10 +1016,10 @@ void WebContentsImpl::WasShown() { } bool is_visible = true; - content::NotificationService::current()->Notify( - content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, - content::Source<WebContents>(this), - content::Details<bool>(&is_visible)); + NotificationService::current()->Notify( + NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, + Source<WebContents>(this), + Details<bool>(&is_visible)); } void WebContentsImpl::WasHidden() { @@ -1077,10 +1037,10 @@ void WebContentsImpl::WasHidden() { } bool is_visible = false; - content::NotificationService::current()->Notify( - content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, - content::Source<WebContents>(this), - content::Details<bool>(&is_visible)); + NotificationService::current()->Notify( + NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, + Source<WebContents>(this), + Details<bool>(&is_visible)); } bool WebContentsImpl::NeedToFireBeforeUnload() { @@ -1127,15 +1087,14 @@ void WebContentsImpl::Focus() { } void WebContentsImpl::Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { + const NotificationSource& source, + const NotificationDetails& details) { switch (type) { - case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: - OnWebContentsDestroyed( - content::Source<content::WebContents>(source).ptr()); + case NOTIFICATION_WEB_CONTENTS_DESTROYED: + OnWebContentsDestroyed(Source<WebContents>(source).ptr()); break; - case content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED: { - RenderWidgetHost* host = content::Source<RenderWidgetHost>(source).ptr(); + case NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED: { + RenderWidgetHost* host = Source<RenderWidgetHost>(source).ptr(); for (PendingWidgetViews::iterator i = pending_widget_views_.begin(); i != pending_widget_views_.end(); ++i) { if (host->GetView() == i->second) { @@ -1156,13 +1115,13 @@ void WebContentsImpl::Init(BrowserContext* browser_context, const WebContents* base_web_contents) { render_manager_.Init(browser_context, site_instance, routing_id); - view_.reset(content::GetContentClient()->browser()-> + view_.reset(GetContentClient()->browser()-> OverrideCreateWebContentsView(this, &render_view_host_delegate_view_)); if (view_.get()) { CHECK(render_view_host_delegate_view_); } else { - content::WebContentsViewDelegate* delegate = - content::GetContentClient()->browser()->GetWebContentsViewDelegate( + WebContentsViewDelegate* delegate = + GetContentClient()->browser()->GetWebContentsViewDelegate( this); view_.reset(CreateWebContentsView( this, delegate, &render_view_host_delegate_view_)); @@ -1177,26 +1136,26 @@ void WebContentsImpl::Init(BrowserContext* browser_context, // Listen for whether our opener gets destroyed. if (opener_) { - registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, - content::Source<WebContents>(opener_)); + registrar_.Add(this, NOTIFICATION_WEB_CONTENTS_DESTROYED, + Source<WebContents>(opener_)); } registrar_.Add(this, - content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, - content::NotificationService::AllBrowserContextsAndSources()); + NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, + NotificationService::AllBrowserContextsAndSources()); #if defined(ENABLE_JAVA_BRIDGE) java_bridge_dispatcher_host_manager_.reset( new JavaBridgeDispatcherHostManager(this)); #endif - old_browser_plugin_host_.reset(new content::old::BrowserPluginHost(this)); + old_browser_plugin_host_.reset(new old::BrowserPluginHost(this)); } void WebContentsImpl::OnWebContentsDestroyed(WebContents* web_contents) { // Clear the opener if it has been closed. if (web_contents == opener_) { - registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, - content::Source<WebContents>(opener_)); + registrar_.Remove(this, NOTIFICATION_WEB_CONTENTS_DESTROYED, + Source<WebContents>(opener_)); opener_ = NULL; } } @@ -1327,10 +1286,10 @@ void WebContentsImpl::CreateNewWindow( // // http://crbug.com/142685 const std::string& partition_id = - content::GetContentClient()->browser()-> + GetContentClient()->browser()-> GetStoragePartitionIdForSite(GetBrowserContext(), site_instance->GetSiteURL()); - content::StoragePartition* partition = + StoragePartition* partition = BrowserContext::GetStoragePartition(GetBrowserContext(), site_instance); DOMStorageContextImpl* dom_storage_context = @@ -1346,7 +1305,7 @@ void WebContentsImpl::CreateNewWindow( new_contents->set_opener_web_ui_type(GetWebUITypeForCurrentState()); if (!params.opener_suppressed) { - content::WebContentsView* new_view = new_contents->GetView(); + WebContentsView* new_view = new_contents->GetView(); // TODO(brettw): It seems bogus that we have to call this function on the // newly created object and give it one of its own member variables. @@ -1374,11 +1333,11 @@ void WebContentsImpl::CreateNewWindow( params.user_gesture, &was_blocked); } if (!was_blocked) { - content::OpenURLParams open_params(params.target_url, - content::Referrer(), - CURRENT_TAB, - content::PAGE_TRANSITION_LINK, - true /* is_renderer_initiated */); + OpenURLParams open_params(params.target_url, + Referrer(), + CURRENT_TAB, + PAGE_TRANSITION_LINK, + true /* is_renderer_initiated */); new_contents->OpenURL(open_params); } } @@ -1396,7 +1355,7 @@ void WebContentsImpl::CreateNewFullscreenWidget(int route_id) { void WebContentsImpl::CreateNewWidget(int route_id, bool is_fullscreen, WebKit::WebPopupType popup_type) { - content::RenderProcessHost* process = GetRenderProcessHost(); + RenderProcessHost* process = GetRenderProcessHost(); RenderWidgetHostImpl* widget_host = new RenderWidgetHostImpl(this, process, route_id); created_widgets_.insert(widget_host); @@ -1512,8 +1471,8 @@ RenderWidgetHostView* WebContentsImpl::GetCreatedWidget(int route_id) { } void WebContentsImpl::ShowContextMenu( - const content::ContextMenuParams& params, - content::ContextMenuSourceType type) { + const ContextMenuParams& params, + ContextMenuSourceType type) { // Allow WebContentsDelegates to handle the context menu operation first. if (delegate_ && delegate_->HandleContextMenu(params)) return; @@ -1522,12 +1481,12 @@ void WebContentsImpl::ShowContextMenu( } void WebContentsImpl::RequestMediaAccessPermission( - const content::MediaStreamRequest* request, - const content::MediaResponseCallback& callback) { + const MediaStreamRequest* request, + const MediaResponseCallback& callback) { if (delegate_) delegate_->RequestMediaAccessPermission(this, request, callback); else - callback.Run(content::MediaStreamDevices()); + callback.Run(MediaStreamDevices()); } #if defined(OS_ANDROID) @@ -1582,7 +1541,7 @@ bool WebContentsImpl::NavigateToPendingEntry( } void WebContentsImpl::RenderViewForInterstitialPageCreated( - content::RenderViewHost* render_view_host) { + RenderViewHost* render_view_host) { FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewForInterstitialPageCreated(render_view_host)); } @@ -1592,7 +1551,7 @@ bool WebContentsImpl::NavigateToEntry( NavigationController::ReloadType reload_type) { // The renderer will reject IPC messages with URLs longer than // this limit, so don't attempt to navigate with a longer URL. - if (entry.GetURL().spec().size() > content::kMaxURLChars) + if (entry.GetURL().spec().size() > kMaxURLChars) return false; RenderViewHostImpl* dest_render_view_host = @@ -1604,16 +1563,16 @@ bool WebContentsImpl::NavigateToEntry( // Double check that here. int enabled_bindings = dest_render_view_host->GetEnabledBindings(); WebUIControllerFactory* factory = - content::GetContentClient()->browser()->GetWebUIControllerFactory(); + GetContentClient()->browser()->GetWebUIControllerFactory(); bool data_urls_allowed = delegate_ && delegate_->CanLoadDataURLsInWebUI(); bool is_allowed_in_web_ui_renderer = factory && factory->IsURLAcceptableForWebUI(GetBrowserContext(), entry.GetURL(), data_urls_allowed); - if ((enabled_bindings & content::BINDINGS_POLICY_WEB_UI) && + if ((enabled_bindings & BINDINGS_POLICY_WEB_UI) && !is_allowed_in_web_ui_renderer) { // Log the URL to help us diagnose any future failures of this CHECK. - content::GetContentClient()->SetActiveURL(entry.GetURL()); + GetContentClient()->SetActiveURL(entry.GetURL()); CHECK(0); } @@ -1721,7 +1680,7 @@ void WebContentsImpl::OnSavePage() { if (!IsSavable()) { download_stats::RecordDownloadSource( download_stats::INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML); - SaveURL(GetURL(), content::Referrer(), true); + SaveURL(GetURL(), Referrer(), true); return; } @@ -1739,12 +1698,12 @@ void WebContentsImpl::OnSavePage() { // file name sanitation and extension / mime checking. bool WebContentsImpl::SavePage(const FilePath& main_file, const FilePath& dir_path, - content::SavePageType save_type) { + SavePageType save_type) { // Stop the page from navigating. Stop(); save_package_ = new SavePackage(this, save_type, main_file, dir_path); - return save_package_->Init(content::SavePackageDownloadCreatedCallback()); + return save_package_->Init(SavePackageDownloadCreatedCallback()); } void WebContentsImpl::GenerateMHTML( @@ -1779,7 +1738,7 @@ void WebContentsImpl::ResetOverrideEncoding() { Send(new ViewMsg_ResetPageEncodingToDefault(GetRoutingID())); } -content::RendererPreferences* WebContentsImpl::GetMutableRendererPrefs() { +RendererPreferences* WebContentsImpl::GetMutableRendererPrefs() { return &renderer_preferences_; } @@ -1901,13 +1860,13 @@ int WebContentsImpl::GetContentRestrictions() const { WebUI::TypeID WebContentsImpl::GetWebUITypeForCurrentState() { WebUIControllerFactory* factory = - content::GetContentClient()->browser()->GetWebUIControllerFactory(); + GetContentClient()->browser()->GetWebUIControllerFactory(); if (!factory) return WebUI::kNoWebUI; return factory->GetWebUIType(GetBrowserContext(), GetURL()); } -content::WebUI* WebContentsImpl::GetWebUIForCurrentState() { +WebUI* WebContentsImpl::GetWebUIForCurrentState() { // When there is a pending navigation entry, we want to use the pending WebUI // that goes along with it to control the basic flags. For example, we want to // show the pending URL in the URL bar, so we want the display_url flag to @@ -1970,7 +1929,7 @@ void WebContentsImpl::DidEndColorChooser(int color_chooser_id) { } bool WebContentsImpl::FocusLocationBarByDefault() { - content::WebUI* web_ui = GetWebUIForCurrentState(); + WebUI* web_ui = GetWebUIForCurrentState(); if (web_ui) return web_ui->ShouldFocusLocationBarByDefault(); NavigationEntry* entry = controller_.GetActiveEntry(); @@ -2001,16 +1960,16 @@ void WebContentsImpl::OnWebIntentDispatch( } void WebContentsImpl::DidStartProvisionalLoadForFrame( - content::RenderViewHost* render_view_host, + RenderViewHost* render_view_host, int64 frame_id, int64 parent_frame_id, bool is_main_frame, const GURL& opener_url, const GURL& url) { - bool is_error_page = (url.spec() == content::kUnreachableWebDataURL); + bool is_error_page = (url.spec() == kUnreachableWebDataURL); GURL validated_url(url); GURL validated_opener_url(opener_url); - content::RenderProcessHost* render_process_host = + RenderProcessHost* render_process_host = render_view_host->GetProcess(); RenderViewHost::FilterURL( render_process_host->GetID(), @@ -2037,7 +1996,7 @@ void WebContentsImpl::DidStartProvisionalLoadForFrame( } void WebContentsImpl::DidRedirectProvisionalLoad( - content::RenderViewHost* render_view_host, + RenderViewHost* render_view_host, int32 page_id, const GURL& opener_url, const GURL& source_url, @@ -2048,7 +2007,7 @@ void WebContentsImpl::DidRedirectProvisionalLoad( GURL validated_source_url(source_url); GURL validated_target_url(target_url); GURL validated_opener_url(opener_url); - content::RenderProcessHost* render_process_host = + RenderProcessHost* render_process_host = render_view_host->GetProcess(); RenderViewHostImpl::FilterURL( ChildProcessSecurityPolicyImpl::GetInstance(), @@ -2083,7 +2042,7 @@ void WebContentsImpl::DidRedirectProvisionalLoad( } void WebContentsImpl::DidFailProvisionalLoadWithError( - content::RenderViewHost* render_view_host, + RenderViewHost* render_view_host, const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() << ", error_code: " << params.error_code @@ -2093,7 +2052,7 @@ void WebContentsImpl::DidFailProvisionalLoadWithError( params.showing_repost_interstitial << ", frame_id: " << params.frame_id; GURL validated_url(params.url); - content::RenderProcessHost* render_process_host = + RenderProcessHost* render_process_host = render_view_host->GetProcess(); RenderViewHost::FilterURL( render_process_host->GetID(), @@ -2155,20 +2114,20 @@ void WebContentsImpl::OnDidLoadResourceFromMemoryCache( net::CertStatus cert_status = 0; int security_bits = -1; int connection_status = 0; - content::DeserializeSecurityInfo(security_info, &cert_id, &cert_status, - &security_bits, &connection_status); - content::LoadFromMemoryCacheDetails details( + DeserializeSecurityInfo(security_info, &cert_id, &cert_status, + &security_bits, &connection_status); + LoadFromMemoryCacheDetails details( url, GetRenderProcessHost()->GetID(), cert_id, cert_status, http_method, mime_type, resource_type); - content::NotificationService::current()->Notify( - content::NOTIFICATION_LOAD_FROM_MEMORY_CACHE, - content::Source<NavigationController>(&controller_), - content::Details<content::LoadFromMemoryCacheDetails>(&details)); + NotificationService::current()->Notify( + NOTIFICATION_LOAD_FROM_MEMORY_CACHE, + Source<NavigationController>(&controller_), + Details<LoadFromMemoryCacheDetails>(&details)); } void WebContentsImpl::OnDidDisplayInsecureContent() { - content::RecordAction(UserMetricsAction("SSL.DisplayedInsecureContent")); + RecordAction(UserMetricsAction("SSL.DisplayedInsecureContent")); displayed_insecure_content_ = true; SSLManager::NotifySSLInternalStateChanged(&GetController()); } @@ -2177,9 +2136,9 @@ void WebContentsImpl::OnDidRunInsecureContent( const std::string& security_origin, const GURL& target_url) { LOG(INFO) << security_origin << " ran insecure content from " << target_url.possibly_invalid_spec(); - content::RecordAction(UserMetricsAction("SSL.RanInsecureContent")); + RecordAction(UserMetricsAction("SSL.RanInsecureContent")); if (EndsWith(security_origin, kDotGoogleDotCom, false)) - content::RecordAction(UserMetricsAction("SSL.RanInsecureContentGoogle")); + RecordAction(UserMetricsAction("SSL.RanInsecureContentGoogle")); controller_.ssl_manager()->DidRunInsecureContent(security_origin); displayed_insecure_content_ = true; SSLManager::NotifySSLInternalStateChanged(&GetController()); @@ -2228,9 +2187,9 @@ void WebContentsImpl::OnGoToEntryAtOffset(int offset) { // want to create a pending navigation entry (it might end up lingering // http://crbug.com/51680). entry->SetTransitionType( - content::PageTransitionFromInt( + PageTransitionFromInt( entry->GetTransitionType() | - content::PAGE_TRANSITION_FORWARD_BACK)); + PAGE_TRANSITION_FORWARD_BACK)); NavigateToEntry(*entry, NavigationControllerImpl::NO_RELOAD); // If the entry is being restored and doesn't have a SiteInstance yet, fill @@ -2252,7 +2211,7 @@ void WebContentsImpl::OnUpdateZoomLimits(int minimum_percent, } void WebContentsImpl::OnSaveURL(const GURL& url, - const content::Referrer& referrer) { + const Referrer& referrer) { download_stats::RecordDownloadSource( download_stats::INITIATED_BY_PEPPER_SAVE); // Check if the URL to save matches the URL of the main frame. Since this @@ -2410,7 +2369,7 @@ void WebContentsImpl::OnBrowserPluginCreateGuest( // BrowserPluginEmbedder exists for this WebContents. CHECK(!browser_plugin_embedder_.get()); browser_plugin_embedder_.reset( - content::BrowserPluginEmbedder::Create(this, GetRenderViewHost())); + BrowserPluginEmbedder::Create(this, GetRenderViewHost())); browser_plugin_embedder_->CreateGuest(GetRenderViewHost(), instance_id, storage_partition_id, @@ -2438,20 +2397,18 @@ void WebContentsImpl::SetIsLoading(bool is_loading, if (delegate_) delegate_->LoadingStateChanged(this); - NotifyNavigationStateChanged(content::INVALIDATE_TYPE_LOAD); + NotifyNavigationStateChanged(INVALIDATE_TYPE_LOAD); - int type = is_loading ? content::NOTIFICATION_LOAD_START : - content::NOTIFICATION_LOAD_STOP; - content::NotificationDetails det = content::NotificationService::NoDetails(); + int type = is_loading ? NOTIFICATION_LOAD_START : NOTIFICATION_LOAD_STOP; + NotificationDetails det = NotificationService::NoDetails(); if (details) - det = content::Details<LoadNotificationDetails>(details); - content::NotificationService::current()->Notify(type, - content::Source<NavigationController>(&controller_), - det); + det = Details<LoadNotificationDetails>(details); + NotificationService::current()->Notify( + type, Source<NavigationController>(&controller_), det); } void WebContentsImpl::DidNavigateMainFramePostCommit( - const content::LoadCommittedDetails& details, + const LoadCommittedDetails& details, const ViewHostMsg_FrameNavigate_Params& params) { if (opener_web_ui_type_ != WebUI::kNoWebUI) { // If this is a window.open navigation, use the same WebUI as the renderer @@ -2491,7 +2448,7 @@ void WebContentsImpl::DidNavigateMainFramePostCommit( void WebContentsImpl::DidNavigateAnyFramePostCommit( RenderViewHost* render_view_host, - const content::LoadCommittedDetails& details, + const LoadCommittedDetails& details, const ViewHostMsg_FrameNavigate_Params& params) { // If we navigate off the page, reset JavaScript state. This does nothing // to prevent a malicious script from spamming messages, since the script @@ -2553,13 +2510,13 @@ bool WebContentsImpl::UpdateTitleForEntry(NavigationEntryImpl* entry, // Lastly, set the title for the view. view_->SetPageTitle(final_title); - std::pair<content::NavigationEntry*, bool> details = + std::pair<NavigationEntry*, bool> details = std::make_pair(entry, explicit_set); - content::NotificationService::current()->Notify( - content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, - content::Source<WebContents>(this), - content::Details<std::pair<content::NavigationEntry*, bool> >(&details)); + NotificationService::current()->Notify( + NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, + Source<WebContents>(this), + Details<std::pair<NavigationEntry*, bool> >(&details)); return true; } @@ -2569,10 +2526,10 @@ void WebContentsImpl::NotifySwapped() { // notification so that clients that pick up a pointer to |this| can NULL the // pointer. See Bug 1230284. notify_disconnection_ = true; - content::NotificationService::current()->Notify( - content::NOTIFICATION_WEB_CONTENTS_SWAPPED, - content::Source<WebContents>(this), - content::NotificationService::NoDetails()); + NotificationService::current()->Notify( + NOTIFICATION_WEB_CONTENTS_SWAPPED, + Source<WebContents>(this), + NotificationService::NoDetails()); // Ensure that the associated embedder gets cleared after a RenderViewHost // gets swapped, so we don't reuse the same embedder next time a @@ -2582,10 +2539,10 @@ void WebContentsImpl::NotifySwapped() { void WebContentsImpl::NotifyConnected() { notify_disconnection_ = true; - content::NotificationService::current()->Notify( - content::NOTIFICATION_WEB_CONTENTS_CONNECTED, - content::Source<WebContents>(this), - content::NotificationService::NoDetails()); + NotificationService::current()->Notify( + NOTIFICATION_WEB_CONTENTS_CONNECTED, + Source<WebContents>(this), + NotificationService::NoDetails()); } void WebContentsImpl::NotifyDisconnected() { @@ -2593,10 +2550,10 @@ void WebContentsImpl::NotifyDisconnected() { return; notify_disconnection_ = false; - content::NotificationService::current()->Notify( - content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, - content::Source<WebContents>(this), - content::NotificationService::NoDetails()); + NotificationService::current()->Notify( + NOTIFICATION_WEB_CONTENTS_DISCONNECTED, + Source<WebContents>(this), + NotificationService::NoDetails()); } RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { @@ -2608,8 +2565,8 @@ WebContentsImpl::GetRendererManagementDelegate() { return &render_manager_; } -content::RendererPreferences WebContentsImpl::GetRendererPrefs( - content::BrowserContext* browser_context) const { +RendererPreferences WebContentsImpl::GetRendererPrefs( + BrowserContext* browser_context) const { return renderer_preferences_; } @@ -2635,10 +2592,10 @@ void WebContentsImpl::RenderViewCreated(RenderViewHost* render_view_host) { if (static_cast<RenderViewHostImpl*>(render_view_host)->is_swapped_out()) return; - content::NotificationService::current()->Notify( - content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, - content::Source<WebContents>(this), - content::Details<RenderViewHost>(render_view_host)); + NotificationService::current()->Notify( + NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, + Source<WebContents>(this), + Details<RenderViewHost>(render_view_host)); NavigationEntry* entry = controller_.GetActiveEntry(); if (!entry) return; @@ -2707,7 +2664,7 @@ void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { void WebContentsImpl::DidNavigate( RenderViewHost* rvh, const ViewHostMsg_FrameNavigate_Params& params) { - if (content::PageTransitionIsMainFrame(params.transition)) + if (PageTransitionIsMainFrame(params.transition)) render_manager_.DidNavigateMainFrame(rvh); // Update the site of the SiteInstance if it doesn't have one yet, unless @@ -2726,30 +2683,30 @@ void WebContentsImpl::DidNavigate( // (see http://code.google.com/p/chromium/issues/detail?id=2929 ) // TODO(jungshik): Add a test for the encoding menu to avoid // regressing it again. - if (content::PageTransitionIsMainFrame(params.transition)) + if (PageTransitionIsMainFrame(params.transition)) contents_mime_type_ = params.contents_mime_type; - content::LoadCommittedDetails details; + LoadCommittedDetails details; bool did_navigate = controller_.RendererDidNavigate(params, &details); // Send notification about committed provisional loads. This notification is // different from the NAV_ENTRY_COMMITTED notification which doesn't include // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. - if (details.type != content::NAVIGATION_TYPE_NAV_IGNORE) { + if (details.type != NAVIGATION_TYPE_NAV_IGNORE) { // For AUTO_SUBFRAME navigations, an event for the main frame is generated // that is not recorded in the navigation history. For the purpose of // tracking navigation events, we treat this event as a sub frame navigation // event. bool is_main_frame = did_navigate ? details.is_main_frame : false; - content::PageTransition transition_type = params.transition; + PageTransition transition_type = params.transition; // Whether or not a page transition was triggered by going backward or // forward in the history is only stored in the navigation controller's // entry list. if (did_navigate && (controller_.GetActiveEntry()->GetTransitionType() & - content::PAGE_TRANSITION_FORWARD_BACK)) { - transition_type = content::PageTransitionFromInt( - params.transition | content::PAGE_TRANSITION_FORWARD_BACK); + PAGE_TRANSITION_FORWARD_BACK)) { + transition_type = PageTransitionFromInt( + params.transition | PAGE_TRANSITION_FORWARD_BACK); } // Notify observers about the commit of the provisional load. FOR_EACH_OBSERVER(WebContentsObserver, observers_, @@ -2824,7 +2781,7 @@ void WebContentsImpl::UpdateTitle(RenderViewHost* rvh, // Broadcast notifications when the UI should be updated. if (entry == controller_.GetEntryAtOffset(0)) - NotifyNavigationStateChanged(content::INVALIDATE_TYPE_TITLE); + NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE); } void WebContentsImpl::UpdateEncoding(RenderViewHost* render_view_host, @@ -2865,8 +2822,7 @@ void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { delegate_->MoveContents(this, new_bounds); } -void WebContentsImpl::DidStartLoading( - content::RenderViewHost* render_view_host) { +void WebContentsImpl::DidStartLoading(RenderViewHost* render_view_host) { SetIsLoading(true, NULL); if (delegate_ && content_restrictions_) @@ -2877,8 +2833,7 @@ void WebContentsImpl::DidStartLoading( DidStartLoading(render_view_host)); } -void WebContentsImpl::DidStopLoading( - content::RenderViewHost* render_view_host) { +void WebContentsImpl::DidStopLoading(RenderViewHost* render_view_host) { scoped_ptr<LoadNotificationDetails> details; NavigationEntry* entry = controller_.GetActiveEntry(); @@ -2906,7 +2861,7 @@ void WebContentsImpl::DidCancelLoading() { controller_.DiscardNonCommittedEntries(); // Update the URL display. - NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL); + NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); } void WebContentsImpl::DidChangeLoadProgress(double progress) { @@ -2927,15 +2882,15 @@ void WebContentsImpl::DocumentAvailableInMainFrame( void WebContentsImpl::DocumentOnLoadCompletedInMainFrame( RenderViewHost* render_view_host, int32 page_id) { - content::NotificationService::current()->Notify( - content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, - content::Source<WebContents>(this), - content::Details<int>(&page_id)); + NotificationService::current()->Notify( + NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, + Source<WebContents>(this), + Details<int>(&page_id)); } void WebContentsImpl::RequestOpenURL(RenderViewHost* rvh, const GURL& url, - const content::Referrer& referrer, + const Referrer& referrer, WindowOpenDisposition disposition, int64 source_frame_id) { // If this came from a swapped out RenderViewHost, we only allow the request @@ -2953,12 +2908,12 @@ void WebContentsImpl::RequestOpenURL(RenderViewHost* rvh, void WebContentsImpl::RequestTransferURL( const GURL& url, - const content::Referrer& referrer, + const Referrer& referrer, WindowOpenDisposition disposition, int64 source_frame_id, const GlobalRequestID& old_request_id) { WebContents* new_contents = NULL; - content::PageTransition transition_type = content::PAGE_TRANSITION_LINK; + PageTransition transition_type = PAGE_TRANSITION_LINK; if (render_manager_.web_ui()) { // When we're a Web UI, it will provide a page transition type for us (this // is so the new tab page can specify AUTO_BOOKMARK for automatically @@ -2968,7 +2923,7 @@ void WebContentsImpl::RequestTransferURL( // want web sites to see a referrer of "chrome://blah" (and some // chrome: URLs might have search terms or other stuff we don't want to // send to the site), so we send no referrer. - OpenURLParams params(url, content::Referrer(), source_frame_id, disposition, + OpenURLParams params(url, Referrer(), source_frame_id, disposition, render_manager_.web_ui()->GetLinkTransitionType(), false /* is_renderer_initiated */); params.transferred_global_request_id = old_request_id; @@ -2976,7 +2931,7 @@ void WebContentsImpl::RequestTransferURL( transition_type = render_manager_.web_ui()->GetLinkTransitionType(); } else { OpenURLParams params(url, referrer, source_frame_id, disposition, - content::PAGE_TRANSITION_LINK, true /* is_renderer_initiated */); + PAGE_TRANSITION_LINK, true /* is_renderer_initiated */); params.transferred_global_request_id = old_request_id; new_contents = OpenURL(params); } @@ -3065,7 +3020,7 @@ void WebContentsImpl::RunJavaScriptMessage( const string16& message, const string16& default_prompt, const GURL& frame_url, - content::JavaScriptMessageType javascript_message_type, + JavaScriptMessageType javascript_message_type, IPC::Message* reply_msg, bool* did_suppress_message) { // Suppress JavaScript dialogs when requested. Also suppress messages when @@ -3079,7 +3034,7 @@ void WebContentsImpl::RunJavaScriptMessage( !delegate_->GetJavaScriptDialogCreator(); if (!suppress_this_message) { - std::string accept_lang = content::GetContentClient()->browser()-> + std::string accept_lang = GetContentClient()->browser()-> GetAcceptLangs(GetBrowserContext()); dialog_creator_ = delegate_->GetJavaScriptDialogCreator(); dialog_creator_->RunJavaScriptDialog( @@ -3151,7 +3106,7 @@ WebPreferences WebContentsImpl::GetWebkitPrefs() { } int WebContentsImpl::CreateSwappedOutRenderView( - content::SiteInstance* instance) { + SiteInstance* instance) { return render_manager_.CreateRenderView(instance, MSG_ROUTING_NONE, true); } @@ -3181,7 +3136,7 @@ void WebContentsImpl::RendererUnresponsive(RenderViewHost* rvh, // since the event may be a result of the renderer sitting on a breakpoint. // See http://crbug.com/65458 DevToolsAgentHost* agent = - content::DevToolsAgentHostRegistry::GetDevToolsAgentHost(rvh); + DevToolsAgentHostRegistry::GetDevToolsAgentHost(rvh); if (agent && DevToolsManagerImpl::GetInstance()->GetDevToolsClientHostFor(agent)) return; @@ -3223,13 +3178,12 @@ void WebContentsImpl::LoadStateChanged( upload_position_ = upload_position; upload_size_ = upload_size; load_state_host_ = net::IDNToUnicode(url.host(), - content::GetContentClient()->browser()->GetAcceptLangs( + GetContentClient()->browser()->GetAcceptLangs( GetBrowserContext())); if (load_state_.state == net::LOAD_STATE_READING_RESPONSE) SetNotWaitingForResponse(); if (IsLoading()) { - NotifyNavigationStateChanged( - content::INVALIDATE_TYPE_LOAD | content::INVALIDATE_TYPE_TAB); + NotifyNavigationStateChanged(INVALIDATE_TYPE_LOAD | INVALIDATE_TYPE_TAB); } } @@ -3371,12 +3325,12 @@ void WebContentsImpl::OnDialogClosed(RenderViewHost* rvh, } void WebContentsImpl::SetEncoding(const std::string& encoding) { - encoding_ = content::GetContentClient()->browser()-> + encoding_ = GetContentClient()->browser()-> GetCanonicalEncodingNameByAliasName(encoding); } void WebContentsImpl::SaveURL(const GURL& url, - const content::Referrer& referrer, + const Referrer& referrer, bool is_main_frame) { DownloadManager* dlm = BrowserContext::GetDownloadManager(GetBrowserContext()); @@ -3388,8 +3342,7 @@ void WebContentsImpl::SaveURL(const GURL& url, if (entry) post_id = entry->GetPostID(); } - scoped_ptr<content::DownloadSaveInfo> save_info( - new content::DownloadSaveInfo()); + scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo()); save_info->prompt_for_save_location = true; scoped_ptr<DownloadUrlParameters> params( DownloadUrlParameters::FromWebContents(this, url, save_info.Pass())); @@ -3413,10 +3366,10 @@ RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { } void WebContentsImpl::GetBrowserPluginEmbedderInfo( - content::RenderViewHost* render_view_host, + RenderViewHost* render_view_host, std::string* embedder_channel_name, int* embedder_container_id) { - content::RenderProcessHost* embedder_render_process_host = + RenderProcessHost* embedder_render_process_host = old_browser_plugin_host()->embedder_render_process_host(); *embedder_container_id = old_browser_plugin_host()->instance_id(); int embedder_process_id = @@ -3428,10 +3381,12 @@ void WebContentsImpl::GetBrowserPluginEmbedderInfo( } } -content::BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { +BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { return browser_plugin_guest_.get(); } -content::BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { +BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { return browser_plugin_embedder_.get(); } + +} // namespace content diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h index 6524241..38030a0 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h @@ -33,18 +33,22 @@ #include "base/win/scoped_handle.h" #endif -class InterstitialPageImpl; class SavePackage; class SessionStorageNamespaceImpl; -class WebContentsImpl; struct BrowserPluginHostMsg_ResizeGuest_Params; struct ViewMsg_PostMessage_Params; +namespace webkit_glue { +struct WebIntentData; +struct WebIntentServiceData; +} + namespace content { class BrowserPluginEmbedder; class BrowserPluginGuest; class ColorChooser; class DownloadItem; +class InterstitialPageImpl; class JavaScriptDialogCreator; class RenderViewHost; class RenderViewHostDelegateView; @@ -53,6 +57,7 @@ class RenderWidgetHostImpl; class SiteInstance; class TestWebContents; class WebContentsDelegate; +class WebContentsImpl; class WebContentsObserver; class WebContentsView; class WebContentsViewDelegate; @@ -65,56 +70,49 @@ WebContentsView* CreateWebContentsView( WebContentsViewDelegate* delegate, RenderViewHostDelegateView** render_view_host_delegate_view); -} // namespace content - -namespace webkit_glue { -struct WebIntentData; -struct WebIntentServiceData; -} - class CONTENT_EXPORT WebContentsImpl - : public NON_EXPORTED_BASE(content::WebContents), - public content::RenderViewHostDelegate, - public content::RenderWidgetHostDelegate, + : public NON_EXPORTED_BASE(WebContents), + public RenderViewHostDelegate, + public RenderWidgetHostDelegate, public RenderViewHostManager::Delegate, - public content::NotificationObserver { + public NotificationObserver { public: virtual ~WebContentsImpl(); static WebContentsImpl* Create( - content::BrowserContext* browser_context, - content::SiteInstance* site_instance, + BrowserContext* browser_context, + SiteInstance* site_instance, int routing_id, const WebContentsImpl* base_web_contents); static WebContentsImpl* CreateWithOpener( - content::BrowserContext* browser_context, - content::SiteInstance* site_instance, + BrowserContext* browser_context, + SiteInstance* site_instance, int routing_id, const WebContentsImpl* base_web_contents, WebContentsImpl* opener); // Creates a WebContents to be used as a browser plugin guest. - static WebContentsImpl* CreateGuest(content::BrowserContext* browser_context, + static WebContentsImpl* CreateGuest(BrowserContext* browser_context, const std::string& host, int guest_instance_id); // Returns the content specific prefs for the given RVH. static webkit_glue::WebPreferences GetWebkitPrefs( - content::RenderViewHost* rvh, const GURL& url); + RenderViewHost* rvh, const GURL& url); // Creates a swapped out RenderView. This is used by the browser plugin to // create a swapped out RenderView in the embedder render process for the // guest, to expose the guest's window object to the embedder. // This returns the routing ID of the newly created swapped out RenderView. - int CreateSwappedOutRenderView(content::SiteInstance* instance); + int CreateSwappedOutRenderView(SiteInstance* instance); // Complex initialization here. Specifically needed to avoid having // members call back into our virtual functions in the constructor. - virtual void Init(content::BrowserContext* browser_context, - content::SiteInstance* site_instance, + virtual void Init(BrowserContext* browser_context, + SiteInstance* site_instance, int routing_id, - const content::WebContents* base_web_contents); + const WebContents* base_web_contents); // Returns the SavePackage which manages the page saving job. May be NULL. SavePackage* save_package() const { return save_package_.get(); } @@ -125,7 +123,7 @@ class CONTENT_EXPORT WebContentsImpl // Updates the max page ID for the given SiteInstance in this WebContentsImpl // to be at least |page_id|. - void UpdateMaxPageIDForSiteInstance(content::SiteInstance* site_instance, + void UpdateMaxPageIDForSiteInstance(SiteInstance* site_instance, int32 page_id); // Copy the current map of SiteInstance ID to max page ID from another tab. @@ -143,12 +141,10 @@ class CONTENT_EXPORT WebContentsImpl // // If this method returns false, then the navigation is discarded (equivalent // to calling DiscardPendingEntry on the NavigationController). - bool NavigateToPendingEntry( - content::NavigationController::ReloadType reload_type); + bool NavigateToPendingEntry(NavigationController::ReloadType reload_type); // Called by InterstitialPageImpl when it creates a RenderViewHost. - void RenderViewForInterstitialPageCreated( - content::RenderViewHost* render_view_host); + void RenderViewForInterstitialPageCreated(RenderViewHost* render_view_host); // Sets the passed passed interstitial as the currently showing interstitial. // |interstitial_page| should be non NULL (use the remove_interstitial_page @@ -163,7 +159,7 @@ class CONTENT_EXPORT WebContentsImpl render_manager_.remove_interstitial_page(); } - void set_opener_web_ui_type(content::WebUI::TypeID opener_web_ui_type) { + void set_opener_web_ui_type(WebUI::TypeID opener_web_ui_type) { opener_web_ui_type_ = opener_web_ui_type; } @@ -171,7 +167,7 @@ class CONTENT_EXPORT WebContentsImpl return java_bridge_dispatcher_host_manager_.get(); } - content::old::BrowserPluginHost* old_browser_plugin_host() const { + old::BrowserPluginHost* old_browser_plugin_host() const { return old_browser_plugin_host_.get(); } @@ -180,34 +176,33 @@ class CONTENT_EXPORT WebContentsImpl // Returns guest browser plugin object, or NULL if this WebContents is not a // guest. - content::BrowserPluginGuest* GetBrowserPluginGuest(); + BrowserPluginGuest* GetBrowserPluginGuest(); // Returns embedder browser plugin object, or NULL if this WebContents is not // an embedder. - content::BrowserPluginEmbedder* GetBrowserPluginEmbedder(); + BrowserPluginEmbedder* GetBrowserPluginEmbedder(); - // content::WebContents ------------------------------------------------------ - virtual content::WebContentsDelegate* GetDelegate() OVERRIDE; - virtual void SetDelegate(content::WebContentsDelegate* delegate) OVERRIDE; + // WebContents ------------------------------------------------------ + virtual WebContentsDelegate* GetDelegate() OVERRIDE; + virtual void SetDelegate(WebContentsDelegate* delegate) OVERRIDE; virtual NavigationControllerImpl& GetController() OVERRIDE; virtual const NavigationControllerImpl& GetController() const OVERRIDE; - virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; - virtual content::RenderProcessHost* GetRenderProcessHost() const OVERRIDE; - virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE; + virtual BrowserContext* GetBrowserContext() const OVERRIDE; + virtual RenderProcessHost* GetRenderProcessHost() const OVERRIDE; + virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; virtual int GetRoutingID() const OVERRIDE; - virtual content::RenderWidgetHostView* - GetRenderWidgetHostView() const OVERRIDE; - virtual content::WebContentsView* GetView() const OVERRIDE; - virtual content::WebUI* CreateWebUI(const GURL& url) OVERRIDE; - virtual content::WebUI* GetWebUI() const OVERRIDE; - virtual content::WebUI* GetCommittedWebUI() const OVERRIDE; + virtual RenderWidgetHostView* GetRenderWidgetHostView() const OVERRIDE; + virtual WebContentsView* GetView() const OVERRIDE; + virtual WebUI* CreateWebUI(const GURL& url) OVERRIDE; + virtual WebUI* GetWebUI() const OVERRIDE; + virtual WebUI* GetCommittedWebUI() const OVERRIDE; virtual void SetUserAgentOverride(const std::string& override) OVERRIDE; virtual const std::string& GetUserAgentOverride() const OVERRIDE; virtual const string16& GetTitle() const OVERRIDE; virtual int32 GetMaxPageID() OVERRIDE; virtual int32 GetMaxPageIDForSiteInstance( - content::SiteInstance* site_instance) OVERRIDE; - virtual content::SiteInstance* GetSiteInstance() const OVERRIDE; - virtual content::SiteInstance* GetPendingSiteInstance() const OVERRIDE; + SiteInstance* site_instance) OVERRIDE; + virtual SiteInstance* GetSiteInstance() const OVERRIDE; + virtual SiteInstance* GetPendingSiteInstance() const OVERRIDE; virtual bool IsLoading() const OVERRIDE; virtual bool IsWaitingForResponse() const OVERRIDE; virtual const net::LoadStateWithParam& GetLoadState() const OVERRIDE; @@ -228,19 +223,19 @@ class CONTENT_EXPORT WebContentsImpl virtual void WasHidden() OVERRIDE; virtual bool NeedToFireBeforeUnload() OVERRIDE; virtual void Stop() OVERRIDE; - virtual content::WebContents* Clone() OVERRIDE; + virtual WebContents* Clone() OVERRIDE; virtual gfx::NativeView GetContentNativeView() const OVERRIDE; virtual gfx::NativeView GetNativeView() const OVERRIDE; virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE; virtual void Focus() OVERRIDE; virtual void FocusThroughTabTraversal(bool reverse) OVERRIDE; virtual bool ShowingInterstitialPage() const OVERRIDE; - virtual content::InterstitialPage* GetInterstitialPage() const OVERRIDE; + virtual InterstitialPage* GetInterstitialPage() const OVERRIDE; virtual bool IsSavable() OVERRIDE; virtual void OnSavePage() OVERRIDE; virtual bool SavePage(const FilePath& main_file, const FilePath& dir_path, - content::SavePageType save_type) OVERRIDE; + SavePageType save_type) OVERRIDE; virtual void GenerateMHTML( const FilePath& file, const base::Callback<void(const FilePath&, int64)>& callback) OVERRIDE; @@ -250,7 +245,7 @@ class CONTENT_EXPORT WebContentsImpl virtual bool WillNotifyDisconnection() const OVERRIDE; virtual void SetOverrideEncoding(const std::string& encoding) OVERRIDE; virtual void ResetOverrideEncoding() OVERRIDE; - virtual content::RendererPreferences* GetMutableRendererPrefs() OVERRIDE; + virtual RendererPreferences* GetMutableRendererPrefs() OVERRIDE; virtual void SetNewTabStartTime(const base::TimeTicks& time) OVERRIDE; virtual base::TimeTicks GetNewTabStartTime() const OVERRIDE; virtual void Close() OVERRIDE; @@ -270,8 +265,8 @@ class CONTENT_EXPORT WebContentsImpl virtual int GetMaximumZoomPercent() const OVERRIDE; virtual gfx::Size GetPreferredSize() const OVERRIDE; virtual int GetContentRestrictions() const OVERRIDE; - virtual content::WebUI::TypeID GetWebUITypeForCurrentState() OVERRIDE; - virtual content::WebUI* GetWebUIForCurrentState() OVERRIDE; + virtual WebUI::TypeID GetWebUITypeForCurrentState() OVERRIDE; + virtual WebUI* GetWebUIForCurrentState() OVERRIDE; virtual bool GotResponseToLockMouseRequest(bool allowed) OVERRIDE; virtual bool HasOpener() const OVERRIDE; virtual void DidChooseColorInColorChooser(int color_chooser_id, @@ -279,99 +274,93 @@ class CONTENT_EXPORT WebContentsImpl virtual void DidEndColorChooser(int color_chooser_id) OVERRIDE; // Implementation of PageNavigator. - virtual content::WebContents* OpenURL( - const content::OpenURLParams& params) OVERRIDE; + virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE; // Implementation of IPC::Sender. virtual bool Send(IPC::Message* message) OVERRIDE; // RenderViewHostDelegate ---------------------------------------------------- - virtual content::RenderViewHostDelegateView* GetDelegateView() OVERRIDE; - virtual content::RenderViewHostDelegate::RendererManagement* + virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE; + virtual RenderViewHostDelegate::RendererManagement* GetRendererManagementDelegate() OVERRIDE; - virtual bool OnMessageReceived(content::RenderViewHost* render_view_host, + virtual bool OnMessageReceived(RenderViewHost* render_view_host, const IPC::Message& message) OVERRIDE; virtual const GURL& GetURL() const OVERRIDE; - virtual content::WebContents* GetAsWebContents() OVERRIDE; + virtual WebContents* GetAsWebContents() OVERRIDE; virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; - virtual void RenderViewCreated( - content::RenderViewHost* render_view_host) OVERRIDE; - virtual void RenderViewReady( - content::RenderViewHost* render_view_host) OVERRIDE; - virtual void RenderViewGone(content::RenderViewHost* render_view_host, + virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; + virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE; + virtual void RenderViewGone(RenderViewHost* render_view_host, base::TerminationStatus status, int error_code) OVERRIDE; - virtual void RenderViewDeleted( - content::RenderViewHost* render_view_host) OVERRIDE; + virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; virtual void DidStartProvisionalLoadForFrame( - content::RenderViewHost* render_view_host, + RenderViewHost* render_view_host, int64 frame_id, int64 parent_frame_id, bool main_frame, const GURL& opener_url, const GURL& url) OVERRIDE; virtual void DidRedirectProvisionalLoad( - content::RenderViewHost* render_view_host, + RenderViewHost* render_view_host, int32 page_id, const GURL& opener_url, const GURL& source_url, const GURL& target_url) OVERRIDE; virtual void DidFailProvisionalLoadWithError( - content::RenderViewHost* render_view_host, + RenderViewHost* render_view_host, const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) OVERRIDE; virtual void DidNavigate( - content::RenderViewHost* render_view_host, + RenderViewHost* render_view_host, const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; - virtual void UpdateState(content::RenderViewHost* render_view_host, + virtual void UpdateState(RenderViewHost* render_view_host, int32 page_id, const std::string& state) OVERRIDE; - virtual void UpdateTitle(content::RenderViewHost* render_view_host, + virtual void UpdateTitle(RenderViewHost* render_view_host, int32 page_id, const string16& title, base::i18n::TextDirection title_direction) OVERRIDE; - virtual void UpdateEncoding(content::RenderViewHost* render_view_host, + virtual void UpdateEncoding(RenderViewHost* render_view_host, const std::string& encoding) OVERRIDE; virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE; - virtual void Close(content::RenderViewHost* render_view_host) OVERRIDE; + virtual void Close(RenderViewHost* render_view_host) OVERRIDE; virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE; - virtual void SwappedOut(content::RenderViewHost* render_view_host) OVERRIDE; - virtual void DidStartLoading( - content::RenderViewHost* render_view_host) OVERRIDE; - virtual void DidStopLoading( - content::RenderViewHost* render_view_host) OVERRIDE; + virtual void SwappedOut(RenderViewHost* render_view_host) OVERRIDE; + virtual void DidStartLoading(RenderViewHost* render_view_host) OVERRIDE; + virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; virtual void DidCancelLoading() OVERRIDE; virtual void DidChangeLoadProgress(double progress) OVERRIDE; - virtual void DidUpdateFrameTree(content::RenderViewHost* rvh) OVERRIDE; + virtual void DidUpdateFrameTree(RenderViewHost* rvh) OVERRIDE; virtual void DocumentAvailableInMainFrame( - content::RenderViewHost* render_view_host) OVERRIDE; + RenderViewHost* render_view_host) OVERRIDE; virtual void DocumentOnLoadCompletedInMainFrame( - content::RenderViewHost* render_view_host, + RenderViewHost* render_view_host, int32 page_id) OVERRIDE; - virtual void RequestOpenURL(content::RenderViewHost* rvh, + virtual void RequestOpenURL(RenderViewHost* rvh, const GURL& url, - const content::Referrer& referrer, + const Referrer& referrer, WindowOpenDisposition disposition, int64 source_frame_id) OVERRIDE; virtual void RequestTransferURL( const GURL& url, - const content::Referrer& referrer, + const Referrer& referrer, WindowOpenDisposition disposition, int64 source_frame_id, - const content::GlobalRequestID& transferred_global_request_id) OVERRIDE; - virtual void RouteCloseEvent(content::RenderViewHost* rvh) OVERRIDE; + const GlobalRequestID& transferred_global_request_id) OVERRIDE; + virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE; virtual void RouteMessageEvent( - content::RenderViewHost* rvh, + RenderViewHost* rvh, const ViewMsg_PostMessage_Params& params) OVERRIDE; - virtual void RunJavaScriptMessage(content::RenderViewHost* rvh, + virtual void RunJavaScriptMessage(RenderViewHost* rvh, const string16& message, const string16& default_prompt, const GURL& frame_url, - content::JavaScriptMessageType type, + JavaScriptMessageType type, IPC::Message* reply_msg, bool* did_suppress_message) OVERRIDE; - virtual void RunBeforeUnloadConfirm(content::RenderViewHost* rvh, + virtual void RunBeforeUnloadConfirm(RenderViewHost* rvh, const string16& message, bool is_reload, IPC::Message* reply_msg) OVERRIDE; @@ -379,15 +368,14 @@ class CONTENT_EXPORT WebContentsImpl const string16& message, int32 line_no, const string16& source_id) OVERRIDE; - virtual content::RendererPreferences GetRendererPrefs( - content::BrowserContext* browser_context) const OVERRIDE; + virtual RendererPreferences GetRendererPrefs( + BrowserContext* browser_context) const OVERRIDE; virtual webkit_glue::WebPreferences GetWebkitPrefs() OVERRIDE; virtual void OnUserGesture() OVERRIDE; virtual void OnIgnoredUIEvent() OVERRIDE; - virtual void RendererUnresponsive(content::RenderViewHost* render_view_host, + virtual void RendererUnresponsive(RenderViewHost* render_view_host, bool is_during_unload) OVERRIDE; - virtual void RendererResponsive( - content::RenderViewHost* render_view_host) OVERRIDE; + virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE; virtual void LoadStateChanged(const GURL& url, const net::LoadStateWithParam& load_state, uint64 upload_position, @@ -402,8 +390,8 @@ class CONTENT_EXPORT WebContentsImpl virtual void HandleGestureBegin() OVERRIDE; virtual void HandleGestureEnd() OVERRIDE; virtual void RunFileChooser( - content::RenderViewHost* render_view_host, - const content::FileChooserParams& params) OVERRIDE; + RenderViewHost* render_view_host, + const FileChooserParams& params) OVERRIDE; virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE; virtual bool IsFullscreenForCurrentTab() const OVERRIDE; virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE; @@ -414,7 +402,7 @@ class CONTENT_EXPORT WebContentsImpl virtual void CreateNewWindow( int route_id, const ViewHostMsg_CreateWindow_Params& params, - content::SessionStorageNamespace* session_storage_namespace) OVERRIDE; + SessionStorageNamespace* session_storage_namespace) OVERRIDE; virtual void CreateNewWidget(int route_id, WebKit::WebPopupType popup_type) OVERRIDE; virtual void CreateNewFullscreenWidget(int route_id) OVERRIDE; @@ -426,11 +414,11 @@ class CONTENT_EXPORT WebContentsImpl const gfx::Rect& initial_pos) OVERRIDE; virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; virtual void ShowContextMenu( - const content::ContextMenuParams& params, - content::ContextMenuSourceType type) OVERRIDE; + const ContextMenuParams& params, + ContextMenuSourceType type) OVERRIDE; virtual void RequestMediaAccessPermission( - const content::MediaStreamRequest* request, - const content::MediaResponseCallback& callback) OVERRIDE; + const MediaStreamRequest* request, + const MediaResponseCallback& callback) OVERRIDE; #if defined(OS_ANDROID) virtual void AttachLayer(WebKit::WebLayer* layer) OVERRIDE; @@ -440,46 +428,46 @@ class CONTENT_EXPORT WebContentsImpl // RenderWidgetHostDelegate -------------------------------------------------- virtual void RenderWidgetDeleted( - content::RenderWidgetHostImpl* render_widget_host) OVERRIDE; + RenderWidgetHostImpl* render_widget_host) OVERRIDE; virtual bool PreHandleKeyboardEvent( - const content::NativeWebKeyboardEvent& event, + const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) OVERRIDE; virtual void HandleKeyboardEvent( - const content::NativeWebKeyboardEvent& event) OVERRIDE; + const NativeWebKeyboardEvent& event) OVERRIDE; // RenderViewHostManager::Delegate ------------------------------------------- virtual bool CreateRenderViewForRenderManager( - content::RenderViewHost* render_view_host, int opener_route_id) OVERRIDE; + RenderViewHost* render_view_host, int opener_route_id) OVERRIDE; virtual void BeforeUnloadFiredFromRenderManager( bool proceed, const base::TimeTicks& proceed_time, bool* proceed_to_fire_unload) OVERRIDE; virtual void RenderViewGoneFromRenderManager( - content::RenderViewHost* render_view_host) OVERRIDE; + RenderViewHost* render_view_host) OVERRIDE; virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE; virtual void NotifySwappedFromRenderManager() OVERRIDE; virtual int CreateOpenerRenderViewsForRenderManager( - content::SiteInstance* instance) OVERRIDE; - virtual NavigationControllerImpl& GetControllerForRenderManager() OVERRIDE; + SiteInstance* instance) OVERRIDE; + virtual NavigationControllerImpl& + GetControllerForRenderManager() OVERRIDE; virtual WebUIImpl* CreateWebUIForRenderManager(const GURL& url) OVERRIDE; - virtual content::NavigationEntry* + virtual NavigationEntry* GetLastCommittedNavigationEntryForRenderManager() OVERRIDE; virtual bool FocusLocationBarByDefault() OVERRIDE; virtual void SetFocusToLocationBar(bool select_all) OVERRIDE; - virtual void CreateViewAndSetSizeForRVH( - content::RenderViewHost* rvh) OVERRIDE; + virtual void CreateViewAndSetSizeForRVH(RenderViewHost* rvh) OVERRIDE; - // content::NotificationObserver --------------------------------------------- + // NotificationObserver ------------------------------------------------------ virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE; + const NotificationSource& source, + const NotificationDetails& details) OVERRIDE; private: friend class NavigationControllerImpl; - friend class content::WebContentsObserver; - friend class content::WebContents; // To implement factory methods. + friend class WebContentsObserver; + friend class WebContents; // To implement factory methods. FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); @@ -493,24 +481,24 @@ class CONTENT_EXPORT WebContentsImpl friend class InterstitialPageImpl; // TODO(brettw) TestWebContents shouldn't exist! - friend class content::TestWebContents; + friend class TestWebContents; // See WebContents::Create for a description of these parameters. - WebContentsImpl(content::BrowserContext* browser_context, + WebContentsImpl(BrowserContext* browser_context, WebContentsImpl* opener); // Add and remove observers for page navigation notifications. Adding or // removing multiple times has no effect. The order in which notifications // are sent to observers is undefined. Clients must be sure to remove the // observer before they go away. - void AddObserver(content::WebContentsObserver* observer); - void RemoveObserver(content::WebContentsObserver* observer); + void AddObserver(WebContentsObserver* observer); + void RemoveObserver(WebContentsObserver* observer); // Clears this tab's opener if it has been closed. - void OnWebContentsDestroyed(content::WebContents* web_contents); + void OnWebContentsDestroyed(WebContents* web_contents); // Callback function when showing JS dialogs. - void OnDialogClosed(content::RenderViewHost* rvh, + void OnDialogClosed(RenderViewHost* rvh, IPC::Message* reply_msg, bool success, const string16& user_input); @@ -546,7 +534,7 @@ class CONTENT_EXPORT WebContentsImpl void OnUpdateZoomLimits(int minimum_percent, int maximum_percent, bool remember); - void OnSaveURL(const GURL& url, const content::Referrer& referrer); + void OnSaveURL(const GURL& url, const Referrer& referrer); void OnEnumerateDirectory(int request_id, const FilePath& path); void OnJSOutOfMemory(); @@ -586,7 +574,7 @@ class CONTENT_EXPORT WebContentsImpl // |details| is used to provide details on the load that just finished // (but can be null if not applicable). Can be overridden. void SetIsLoading(bool is_loading, - content::LoadNotificationDetails* details); + LoadNotificationDetails* details); // Called by derived classes to indicate that we're no longer waiting for a // response. This won't actually update the throbber, but it will get picked @@ -602,18 +590,18 @@ class CONTENT_EXPORT WebContentsImpl // not provided since it may be invalid/changed after being committed. The // current navigation entry is in the NavigationController at this point. void DidNavigateMainFramePostCommit( - const content::LoadCommittedDetails& details, + const LoadCommittedDetails& details, const ViewHostMsg_FrameNavigate_Params& params); void DidNavigateAnyFramePostCommit( - content::RenderViewHost* render_view_host, - const content::LoadCommittedDetails& details, + RenderViewHost* render_view_host, + const LoadCommittedDetails& details, const ViewHostMsg_FrameNavigate_Params& params); // If our controller was restored, update the max page ID associated with the // given RenderViewHost to be larger than the number of restored entries. // This is called in CreateRenderView before any navigations in the RenderView // have begun, to prevent any races in updating RenderView::next_page_id. - void UpdateMaxPageIDIfNecessary(content::RenderViewHost* rvh); + void UpdateMaxPageIDIfNecessary(RenderViewHost* rvh); // Saves the given title to the navigation entry and does associated work. It // will update history and the view for the new title, and also synthesize @@ -623,21 +611,21 @@ class CONTENT_EXPORT WebContentsImpl // This is used as the backend for state updates, which include a new title, // or the dedicated set title message. It returns true if the new title is // different and was therefore updated. - bool UpdateTitleForEntry(content::NavigationEntryImpl* entry, + bool UpdateTitleForEntry(NavigationEntryImpl* entry, const string16& title); // Causes the WebContentsImpl to navigate in the right renderer to |entry|, // which must be already part of the entries in the navigation controller. // This does not change the NavigationController state. - bool NavigateToEntry(const content::NavigationEntryImpl& entry, - content::NavigationController::ReloadType reload_type); + bool NavigateToEntry(const NavigationEntryImpl& entry, + NavigationController::ReloadType reload_type); // Sets the history for this WebContentsImpl to |history_length| entries, and // moves the current page_id to the last entry in the list if it's valid. // This is mainly used when a prerendered page is swapped into the current // tab. The method is virtual for testing. virtual void SetHistoryLengthAndPrune( - const content::SiteInstance* site_instance, + const SiteInstance* site_instance, int merge_history_length, int32 minimum_page_id); @@ -645,7 +633,7 @@ class CONTENT_EXPORT WebContentsImpl // (including this tab) in the given SiteInstance, allowing other tabs to send // cross-process JavaScript calls to their opener(s). Returns the route ID of // this tab's RenderView for |instance|. - int CreateOpenerRenderViews(content::SiteInstance* instance); + int CreateOpenerRenderViews(SiteInstance* instance); // Helper for CreateNewWidget/CreateNewFullscreenWidget. void CreateNewWidget(int route_id, @@ -659,7 +647,7 @@ class CONTENT_EXPORT WebContentsImpl // Finds the new RenderWidgetHost and returns it. Note that this can only be // called once as this call also removes it from the internal map. - content::RenderWidgetHostView* GetCreatedWidget(int route_id); + RenderWidgetHostView* GetCreatedWidget(int route_id); // Finds the new WebContentsImpl by route_id, initializes it for // renderer-initiated creation, and returns it. Note that this can only be @@ -677,12 +665,12 @@ class CONTENT_EXPORT WebContentsImpl // Save a URL to the local filesystem. void SaveURL(const GURL& url, - const content::Referrer& referrer, + const Referrer& referrer, bool is_main_frame); - content::RenderViewHostImpl* GetRenderViewHostImpl(); + RenderViewHostImpl* GetRenderViewHostImpl(); - void GetBrowserPluginEmbedderInfo(content::RenderViewHost* render_view_host, + void GetBrowserPluginEmbedderInfo(RenderViewHost* render_view_host, std::string* embedder_channel_name, int* embedder_container_id); @@ -692,18 +680,18 @@ class CONTENT_EXPORT WebContentsImpl // Data for core operation --------------------------------------------------- // Delegate for notifying our owner about stuff. Not owned by us. - content::WebContentsDelegate* delegate_; + WebContentsDelegate* delegate_; // Handles the back/forward list and loading. NavigationControllerImpl controller_; // The corresponding view. - scoped_ptr<content::WebContentsView> view_; + scoped_ptr<WebContentsView> view_; // The view of the RVHD. Usually this is our WebContentsView implementation, // but if an embedder uses a different WebContentsView, they'll need to // provide this. - content::RenderViewHostDelegateView* render_view_host_delegate_view_; + RenderViewHostDelegateView* render_view_host_delegate_view_; // Tracks created WebContentsImpl objects that have not been shown yet. They // are identified by the route ID passed to CreateNewWindow. @@ -712,14 +700,14 @@ class CONTENT_EXPORT WebContentsImpl // These maps hold on to the widgets that we created on behalf of the renderer // that haven't shown yet. - typedef std::map<int, content::RenderWidgetHostView*> PendingWidgetViews; + typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; PendingWidgetViews pending_widget_views_; // A list of observers notified when page state changes. Weak references. // This MUST be listed above render_manager_ since at destruction time the // latter might cause RenderViewHost's destructor to call us and we might use // the observer list then. - ObserverList<content::WebContentsObserver> observers_; + ObserverList<WebContentsObserver> observers_; // The tab that opened this tab, if any. Will be set to null if the opener // is closed. @@ -738,7 +726,7 @@ class CONTENT_EXPORT WebContentsImpl // TODO(fsamuel): Remove this once upstreaming of the new browser plugin // implementation is complete. // Manages the browser plugin instances hosted by this WebContents. - scoped_ptr<content::old::BrowserPluginHost> old_browser_plugin_host_; + scoped_ptr<old::BrowserPluginHost> old_browser_plugin_host_; // SavePackage, lazily created. scoped_refptr<SavePackage> save_package_; @@ -804,7 +792,7 @@ class CONTENT_EXPORT WebContentsImpl // Pointer to the JavaScript dialog creator, lazily assigned. Used because the // delegate of this WebContentsImpl is nulled before its destructor is called. - content::JavaScriptDialogCreator* dialog_creator_; + JavaScriptDialogCreator* dialog_creator_; #if defined(OS_WIN) // Handle to an event that's set when the page is showing a message box (or @@ -819,11 +807,11 @@ class CONTENT_EXPORT WebContentsImpl bool is_showing_before_unload_dialog_; // Settings that get passed to the renderer process. - content::RendererPreferences renderer_preferences_; + RendererPreferences renderer_preferences_; // If this tab was created from a renderer using window.open, this will be // non-NULL and represent the WebUI of the opening renderer. - content::WebUI::TypeID opener_web_ui_type_; + WebUI::TypeID opener_web_ui_type_; // The time that we started to create the new tab page. base::TimeTicks new_tab_start_time_; @@ -856,28 +844,30 @@ class CONTENT_EXPORT WebContentsImpl int content_restrictions_; // Color chooser that was opened by this tab. - content::ColorChooser* color_chooser_; + ColorChooser* color_chooser_; // Manages the embedder state for browser plugins, if this WebContents is an // embedder; NULL otherwise. - scoped_ptr<content::BrowserPluginEmbedder> browser_plugin_embedder_; + scoped_ptr<BrowserPluginEmbedder> browser_plugin_embedder_; // Manages the guest state for browser plugin, if this WebContents is a guest; // NULL otherwise. - scoped_ptr<content::BrowserPluginGuest> browser_plugin_guest_; + scoped_ptr<BrowserPluginGuest> browser_plugin_guest_; // This must be at the end, or else we might get notifications and use other // member variables that are gone. - content::NotificationRegistrar registrar_; + NotificationRegistrar registrar_; // Used during IPC message dispatching so that the handlers can get a pointer // to the RVH through which the message was received. - content::RenderViewHost* message_source_; + RenderViewHost* message_source_; // All live RenderWidgetHostImpls that are created by this object and may // outlive it. - std::set<content::RenderWidgetHostImpl*> created_widgets_; + std::set<RenderWidgetHostImpl*> created_widgets_; DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); }; +} // namespace content + #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc index 8de109b..be7b377 100644 --- a/content/browser/web_contents/web_contents_impl_unittest.cc +++ b/content/browser/web_contents/web_contents_impl_unittest.cc @@ -30,31 +30,15 @@ #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/webkit_glue.h" -using content::BrowserContext; -using content::BrowserThread; -using content::InterstitialPage; -using content::MockRenderProcessHost; -using content::NavigationEntry; -using content::NavigationEntryImpl; -using content::PasswordForm; -using content::SiteInstance; -using content::RenderViewHost; -using content::RenderViewHostImplTestHarness; -using content::TestBrowserThread; -using content::TestRenderViewHost; -using content::TestWebContents; -using content::WebContents; -using content::WebUI; -using content::WebUIController; - +namespace content { namespace { class WebContentsImplTestWebUIControllerFactory - : public content::WebUIControllerFactory { + : public WebUIControllerFactory { public: virtual WebUIController* CreateWebUIControllerForURL( - content::WebUI* web_ui, const GURL& url) const OVERRIDE { - if (!content::GetContentClient()->HasWebUIScheme(url)) + WebUI* web_ui, const GURL& url) const OVERRIDE { + if (!GetContentClient()->HasWebUIScheme(url)) return NULL; return new WebUIController(web_ui); @@ -67,19 +51,19 @@ class WebContentsImplTestWebUIControllerFactory virtual bool UseWebUIForURL(BrowserContext* browser_context, const GURL& url) const OVERRIDE { - return content::GetContentClient()->HasWebUIScheme(url); + return GetContentClient()->HasWebUIScheme(url); } virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, const GURL& url) const OVERRIDE { - return content::GetContentClient()->HasWebUIScheme(url); + return GetContentClient()->HasWebUIScheme(url); } virtual bool IsURLAcceptableForWebUI( BrowserContext* browser_context, const GURL& url, bool data_urls_allowed) const { - return content::GetContentClient()->HasWebUIScheme(url); + return GetContentClient()->HasWebUIScheme(url); } }; @@ -93,14 +77,12 @@ class WebContentsImplTestContentClient : public TestContentClient { } }; -class WebContentsImplTestBrowserClient - : public content::TestContentBrowserClient { +class WebContentsImplTestBrowserClient : public TestContentBrowserClient { public: WebContentsImplTestBrowserClient() { } - virtual content::WebUIControllerFactory* - GetWebUIControllerFactory() OVERRIDE { + virtual WebUIControllerFactory* GetWebUIControllerFactory() OVERRIDE { return &factory_; } @@ -110,7 +92,7 @@ class WebContentsImplTestBrowserClient class TestInterstitialPage; -class TestInterstitialPageDelegate : public content::InterstitialPageDelegate { +class TestInterstitialPageDelegate : public InterstitialPageDelegate { public: TestInterstitialPageDelegate(TestInterstitialPage* interstitial_page) : interstitial_page_(interstitial_page) {} @@ -191,7 +173,7 @@ class TestInterstitialPage : public InterstitialPageImpl { void TestDidNavigate(int page_id, const GURL& url) { ViewHostMsg_FrameNavigate_Params params; - InitNavigateParams(¶ms, page_id, url, content::PAGE_TRANSITION_TYPED); + InitNavigateParams(¶ms, page_id, url, PAGE_TRANSITION_TYPED); DidNavigate(GetRenderViewHostForTesting(), params); } @@ -200,7 +182,7 @@ class TestInterstitialPage : public InterstitialPageImpl { } bool is_showing() const { - return static_cast<content::TestRenderWidgetHostView*>( + return static_cast<TestRenderWidgetHostView*>( GetRenderViewHostForTesting()->GetView())->is_showing(); } @@ -219,13 +201,13 @@ class TestInterstitialPage : public InterstitialPageImpl { } protected: - virtual content::RenderViewHost* CreateRenderViewHost() OVERRIDE { + virtual RenderViewHost* CreateRenderViewHost() OVERRIDE { return new TestRenderViewHost( SiteInstance::Create(web_contents()->GetBrowserContext()), this, this, MSG_ROUTING_NONE, false); } - virtual content::WebContentsView* CreateWebContentsView() OVERRIDE { + virtual WebContentsView* CreateWebContentsView() OVERRIDE { return NULL; } @@ -286,24 +268,24 @@ class WebContentsImplTest : public RenderViewHostImplTestHarness { // We must register it similarly to kChromeUIScheme. url_util::AddStandardScheme("webcontentsimpltest"); - old_client_ = content::GetContentClient(); - old_browser_client_ = content::GetContentClient()->browser(); - content::SetContentClient(&client_); - content::GetContentClient()->set_browser_for_testing(&browser_client_); + old_client_ = GetContentClient(); + old_browser_client_ = GetContentClient()->browser(); + SetContentClient(&client_); + GetContentClient()->set_browser_for_testing(&browser_client_); RenderViewHostImplTestHarness::SetUp(); } virtual void TearDown() { - content::GetContentClient()->set_browser_for_testing(old_browser_client_); - content::SetContentClient(old_client_); + GetContentClient()->set_browser_for_testing(old_browser_client_); + SetContentClient(old_client_); RenderViewHostImplTestHarness::TearDown(); } private: WebContentsImplTestContentClient client_; WebContentsImplTestBrowserClient browser_client_; - content::ContentClient* old_client_; - content::ContentBrowserClient* old_browser_client_; + ContentClient* old_client_; + ContentBrowserClient* old_browser_client_; TestBrowserThread ui_thread_; TestBrowserThread file_user_blocking_thread_; TestBrowserThread io_thread_; @@ -317,9 +299,9 @@ TEST_F(WebContentsImplTest, UpdateTitle) { static_cast<NavigationControllerImpl&>(controller()); ViewHostMsg_FrameNavigate_Params params; InitNavigateParams(¶ms, 0, GURL(chrome::kAboutBlankURL), - content::PAGE_TRANSITION_TYPED); + PAGE_TRANSITION_TYPED); - content::LoadCommittedDetails details; + LoadCommittedDetails details; cont.RendererDidNavigate(params, &details); contents()->UpdateTitle(rvh(), 0, ASCIIToUTF16(" Lots O' Whitespace\n"), @@ -337,16 +319,15 @@ TEST_F(WebContentsImplTest, NTPViewSource) { process()->sink().ClearMessages(); cont.LoadURL( - kGURL, content::Referrer(), content::PAGE_TRANSITION_TYPED, - std::string()); + kGURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); rvh()->GetDelegate()->RenderViewCreated(rvh()); // Did we get the expected message? EXPECT_TRUE(process()->sink().GetFirstMessageMatching( ViewMsg_EnableViewSourceMode::ID)); ViewHostMsg_FrameNavigate_Params params; - InitNavigateParams(¶ms, 0, kGURL, content::PAGE_TRANSITION_TYPED); - content::LoadCommittedDetails details; + InitNavigateParams(¶ms, 0, kGURL, PAGE_TRANSITION_TYPED); + LoadCommittedDetails details; cont.RendererDidNavigate(params, &details); // Also check title and url. EXPECT_EQ(ASCIIToUTF16(kUrl), contents()->GetTitle()); @@ -384,7 +365,7 @@ TEST_F(WebContentsImplTest, SimpleNavigation) { // Navigate to URL const GURL url("http://www.google.com"); controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(instance1, orig_rvh->GetSiteInstance()); // Controller's pending entry will have a NULL site instance until we assign @@ -394,7 +375,7 @@ TEST_F(WebContentsImplTest, SimpleNavigation) { site_instance() == NULL); // DidNavigate from the page - contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(orig_rvh, contents()->GetRenderViewHost()); EXPECT_EQ(instance1, orig_rvh->GetSiteInstance()); @@ -406,15 +387,14 @@ TEST_F(WebContentsImplTest, SimpleNavigation) { site_instance()); } -// Test that we reject NavigateToEntry if the url is over content::kMaxURLChars. +// Test that we reject NavigateToEntry if the url is over kMaxURLChars. TEST_F(WebContentsImplTest, NavigateToExcessivelyLongURL) { // Construct a URL that's kMaxURLChars + 1 long of all 'a's. const GURL url(std::string("http://example.org/").append( - content::kMaxURLChars + 1, 'a')); + kMaxURLChars + 1, 'a')); controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_GENERATED, - std::string()); + url, Referrer(), PAGE_TRANSITION_GENERATED, std::string()); EXPECT_TRUE(controller().GetActiveEntry() == NULL); } @@ -430,8 +410,8 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) { // Navigate to URL. First URL should use first RenderViewHost. const GURL url("http://www.google.com"); controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); + url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); + contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(orig_rvh, contents()->GetRenderViewHost()); @@ -439,7 +419,7 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) { // Navigate to new site const GURL url2("http://www.yahoo.com"); controller().LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_TRUE(contents()->cross_navigation_pending()); TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>(contents()->GetPendingRenderViewHost()); @@ -453,7 +433,7 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) { // DidNavigate from the pending page contents()->TestDidNavigate( - pending_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); + pending_rvh, 1, url2, PAGE_TRANSITION_TYPED); SiteInstance* instance2 = contents()->GetSiteInstance(); EXPECT_FALSE(contents()->cross_navigation_pending()); @@ -480,7 +460,7 @@ TEST_F(WebContentsImplTest, CrossSiteBoundaries) { // DidNavigate from the back action contents()->TestDidNavigate( - goback_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); + goback_rvh, 1, url2, PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(goback_rvh, contents()->GetRenderViewHost()); EXPECT_EQ(instance1, contents()->GetSiteInstance()); @@ -507,8 +487,8 @@ TEST_F(WebContentsImplTest, CrossSiteBoundariesAfterCrash) { // Navigate to URL. First URL should use first RenderViewHost. const GURL url("http://www.google.com"); controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); + url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); + contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(orig_rvh, contents()->GetRenderViewHost()); @@ -519,7 +499,7 @@ TEST_F(WebContentsImplTest, CrossSiteBoundariesAfterCrash) { // Navigate to new site. We should not go into PENDING. const GURL url2("http://www.yahoo.com"); controller().LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); RenderViewHost* new_rvh = rvh(); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_TRUE(contents()->GetPendingRenderViewHost() == NULL); @@ -527,7 +507,7 @@ TEST_F(WebContentsImplTest, CrossSiteBoundariesAfterCrash) { EXPECT_EQ(orig_rvh_delete_count, 1); // DidNavigate from the new page - contents()->TestDidNavigate(new_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(new_rvh, 1, url2, PAGE_TRANSITION_TYPED); SiteInstance* instance2 = contents()->GetSiteInstance(); EXPECT_FALSE(contents()->cross_navigation_pending()); @@ -551,38 +531,37 @@ TEST_F(WebContentsImplTest, NavigateTwoTabsCrossSite) { // Navigate to URL. First URL should use first RenderViewHost. const GURL url("http://www.google.com"); controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); + url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); + contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); // Open a new contents with the same SiteInstance, navigated to the same site. scoped_ptr<TestWebContents> contents2( TestWebContents::Create(browser_context_.get(), instance1)); contents2->transition_cross_site = true; - contents2->GetController().LoadURL(url, content::Referrer(), - content::PAGE_TRANSITION_TYPED, + contents2->GetController().LoadURL(url, Referrer(), + PAGE_TRANSITION_TYPED, std::string()); // Need this page id to be 2 since the site instance is the same (which is the // scope of page IDs) and we want to consider this a new page. contents2->TestDidNavigate( - contents2->GetRenderViewHost(), 2, url, content::PAGE_TRANSITION_TYPED); + contents2->GetRenderViewHost(), 2, url, PAGE_TRANSITION_TYPED); // Navigate first contents to a new site. const GURL url2a("http://www.yahoo.com"); controller().LoadURL( - url2a, content::Referrer(), content::PAGE_TRANSITION_TYPED, - std::string()); + url2a, Referrer(), PAGE_TRANSITION_TYPED, std::string()); orig_rvh->SendShouldCloseACK(true); TestRenderViewHost* pending_rvh_a = static_cast<TestRenderViewHost*>(contents()->GetPendingRenderViewHost()); contents()->TestDidNavigate( - pending_rvh_a, 1, url2a, content::PAGE_TRANSITION_TYPED); + pending_rvh_a, 1, url2a, PAGE_TRANSITION_TYPED); SiteInstance* instance2a = contents()->GetSiteInstance(); EXPECT_NE(instance1, instance2a); // Navigate second contents to the same site as the first tab. const GURL url2b("http://mail.yahoo.com"); - contents2->GetController().LoadURL(url2b, content::Referrer(), - content::PAGE_TRANSITION_TYPED, + contents2->GetController().LoadURL(url2b, Referrer(), + PAGE_TRANSITION_TYPED, std::string()); TestRenderViewHost* rvh2 = static_cast<TestRenderViewHost*>(contents2->GetRenderViewHost()); @@ -596,7 +575,7 @@ TEST_F(WebContentsImplTest, NavigateTwoTabsCrossSite) { // second contents hadn't navigated somewhere first (bug 1145430). That case // is now covered by the CrossSiteBoundariesAfterCrash test. contents2->TestDidNavigate( - pending_rvh_b, 2, url2b, content::PAGE_TRANSITION_TYPED); + pending_rvh_b, 2, url2b, PAGE_TRANSITION_TYPED); SiteInstance* instance2b = contents2->GetSiteInstance(); EXPECT_NE(instance1, instance2b); @@ -614,24 +593,24 @@ TEST_F(WebContentsImplTest, CrossSiteComparesAgainstCurrentPage) { // Navigate to URL. const GURL url("http://www.google.com"); controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); contents()->TestDidNavigate( - orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); + orig_rvh, 1, url, PAGE_TRANSITION_TYPED); // Open a related contents to a second site. scoped_ptr<TestWebContents> contents2( TestWebContents::Create(browser_context_.get(), instance1)); contents2->transition_cross_site = true; const GURL url2("http://www.yahoo.com"); - contents2->GetController().LoadURL(url2, content::Referrer(), - content::PAGE_TRANSITION_TYPED, + contents2->GetController().LoadURL(url2, Referrer(), + PAGE_TRANSITION_TYPED, std::string()); // The first RVH in contents2 isn't live yet, so we shortcut the cross site // pending. TestRenderViewHost* rvh2 = static_cast<TestRenderViewHost*>( contents2->GetRenderViewHost()); EXPECT_FALSE(contents2->cross_navigation_pending()); - contents2->TestDidNavigate(rvh2, 2, url2, content::PAGE_TRANSITION_TYPED); + contents2->TestDidNavigate(rvh2, 2, url2, PAGE_TRANSITION_TYPED); SiteInstance* instance2 = contents2->GetSiteInstance(); EXPECT_NE(instance1, instance2); EXPECT_FALSE(contents2->cross_navigation_pending()); @@ -639,7 +618,7 @@ TEST_F(WebContentsImplTest, CrossSiteComparesAgainstCurrentPage) { // Simulate a link click in first contents to second site. Doesn't switch // SiteInstances, because we don't intercept WebKit navigations. contents()->TestDidNavigate( - orig_rvh, 2, url2, content::PAGE_TRANSITION_TYPED); + orig_rvh, 2, url2, PAGE_TRANSITION_TYPED); SiteInstance* instance3 = contents()->GetSiteInstance(); EXPECT_EQ(instance1, instance3); EXPECT_FALSE(contents()->cross_navigation_pending()); @@ -648,10 +627,10 @@ TEST_F(WebContentsImplTest, CrossSiteComparesAgainstCurrentPage) { // compare against the current URL, not the SiteInstance's site. const GURL url3("http://mail.yahoo.com"); controller().LoadURL( - url3, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url3, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_FALSE(contents()->cross_navigation_pending()); contents()->TestDidNavigate( - orig_rvh, 3, url3, content::PAGE_TRANSITION_TYPED); + orig_rvh, 3, url3, PAGE_TRANSITION_TYPED); SiteInstance* instance4 = contents()->GetSiteInstance(); EXPECT_EQ(instance1, instance4); } @@ -666,15 +645,15 @@ TEST_F(WebContentsImplTest, CrossSiteUnloadHandlers) { // Navigate to URL. First URL should use first RenderViewHost. const GURL url("http://www.google.com"); controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); + url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); + contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(orig_rvh, contents()->GetRenderViewHost()); // Navigate to new site, but simulate an onbeforeunload denial. const GURL url2("http://www.yahoo.com"); controller().LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_TRUE(orig_rvh->is_waiting_for_beforeunload_ack()); orig_rvh->OnMessageReceived(ViewHostMsg_ShouldClose_ACK( 0, false, base::TimeTicks(), base::TimeTicks())); @@ -684,7 +663,7 @@ TEST_F(WebContentsImplTest, CrossSiteUnloadHandlers) { // Navigate again, but simulate an onbeforeunload approval. controller().LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_TRUE(orig_rvh->is_waiting_for_beforeunload_ack()); orig_rvh->OnMessageReceived(ViewHostMsg_ShouldClose_ACK( 0, true, base::TimeTicks(), base::TimeTicks())); @@ -699,7 +678,7 @@ TEST_F(WebContentsImplTest, CrossSiteUnloadHandlers) { // DidNavigate from the pending page contents()->TestDidNavigate( - pending_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); + pending_rvh, 1, url2, PAGE_TRANSITION_TYPED); SiteInstance* instance2 = contents()->GetSiteInstance(); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(pending_rvh, rvh()); @@ -718,15 +697,15 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationPreempted) { // Navigate to URL. First URL should use first RenderViewHost. const GURL url("http://www.google.com"); controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); + url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); + contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(orig_rvh, contents()->GetRenderViewHost()); // Navigate to new site, simulating an onbeforeunload approval. const GURL url2("http://www.yahoo.com"); controller().LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_TRUE(orig_rvh->is_waiting_for_beforeunload_ack()); orig_rvh->OnMessageReceived(ViewHostMsg_ShouldClose_ACK( 0, true, base::TimeTicks(), base::TimeTicks())); @@ -750,9 +729,9 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) { // Start with a web ui page, which gets a new RVH with WebUI bindings. const GURL url1("webcontentsimpltest://blah"); controller().LoadURL( - url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url1, Referrer(), PAGE_TRANSITION_TYPED, std::string()); TestRenderViewHost* ntp_rvh = test_rvh(); - contents()->TestDidNavigate(ntp_rvh, 1, url1, content::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(ntp_rvh, 1, url1, PAGE_TRANSITION_TYPED); NavigationEntry* entry1 = controller().GetLastCommittedEntry(); SiteInstance* instance1 = contents()->GetSiteInstance(); @@ -761,12 +740,12 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) { EXPECT_EQ(url1, entry1->GetURL()); EXPECT_EQ(instance1, NavigationEntryImpl::FromNavigationEntry(entry1)->site_instance()); - EXPECT_TRUE(ntp_rvh->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI); + EXPECT_TRUE(ntp_rvh->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); // Navigate to new site. const GURL url2("http://www.google.com"); controller().LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_TRUE(contents()->cross_navigation_pending()); TestRenderViewHost* google_rvh = static_cast<TestRenderViewHost*>(contents()->GetPendingRenderViewHost()); @@ -778,7 +757,7 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) { // DidNavigate from the pending page. contents()->TestDidNavigate( - google_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); + google_rvh, 1, url2, PAGE_TRANSITION_TYPED); NavigationEntry* entry2 = controller().GetLastCommittedEntry(); SiteInstance* instance2 = contents()->GetSiteInstance(); @@ -789,16 +768,15 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) { EXPECT_EQ(url2, entry2->GetURL()); EXPECT_EQ(instance2, NavigationEntryImpl::FromNavigationEntry(entry2)->site_instance()); - EXPECT_FALSE(google_rvh->GetEnabledBindings() & - content::BINDINGS_POLICY_WEB_UI); + EXPECT_FALSE(google_rvh->GetEnabledBindings() & BINDINGS_POLICY_WEB_UI); // Navigate to third page on same site. const GURL url3("http://news.google.com"); controller().LoadURL( - url3, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url3, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_FALSE(contents()->cross_navigation_pending()); contents()->TestDidNavigate( - google_rvh, 2, url3, content::PAGE_TRANSITION_TYPED); + google_rvh, 2, url3, PAGE_TRANSITION_TYPED); NavigationEntry* entry3 = controller().GetLastCommittedEntry(); SiteInstance* instance3 = contents()->GetSiteInstance(); @@ -827,8 +805,7 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationBackPreempted) { 0, true, base::TimeTicks(), base::TimeTicks())); // DidNavigate from the first back. This aborts the second back's pending RVH. - contents()->TestDidNavigate( - google_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(google_rvh, 1, url2, PAGE_TRANSITION_TYPED); // We should commit this page and forget about the second back. EXPECT_FALSE(contents()->cross_navigation_pending()); @@ -855,20 +832,20 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationNotPreemptedByFrame) { // Navigate to URL. First URL should use first RenderViewHost. const GURL url("http://www.google.com"); controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); + url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); + contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(orig_rvh, contents()->GetRenderViewHost()); // Start navigating to new site. const GURL url2("http://www.yahoo.com"); controller().LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); // Simulate a sub-frame navigation arriving and ensure the RVH is still // waiting for a before unload response. orig_rvh->SendNavigateWithTransition(1, GURL("http://google.com/frame"), - content::PAGE_TRANSITION_AUTO_SUBFRAME); + PAGE_TRANSITION_AUTO_SUBFRAME); EXPECT_TRUE(orig_rvh->is_waiting_for_beforeunload_ack()); // Now simulate the onbeforeunload approval and verify the navigation is @@ -889,14 +866,14 @@ TEST_F(WebContentsImplTest, CrossSiteNotPreemptedDuringBeforeUnload) { // Navigate to NTP URL. const GURL url("webcontentsimpltest://blah"); controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); TestRenderViewHost* orig_rvh = test_rvh(); EXPECT_FALSE(contents()->cross_navigation_pending()); // Navigate to new site, with the beforeunload request in flight. const GURL url2("http://www.yahoo.com"); controller().LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>(contents()->GetPendingRenderViewHost()); EXPECT_TRUE(contents()->cross_navigation_pending()); @@ -911,8 +888,7 @@ TEST_F(WebContentsImplTest, CrossSiteNotPreemptedDuringBeforeUnload) { EXPECT_FALSE(orig_rvh->is_waiting_for_beforeunload_ack()); // The pending navigation should be able to commit successfully. - contents()->TestDidNavigate( - pending_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(pending_rvh, 1, url2, PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(pending_rvh, contents()->GetRenderViewHost()); } @@ -929,15 +905,15 @@ TEST_F(WebContentsImplTest, CrossSiteCantPreemptAfterUnload) { // Navigate to URL. First URL should use first RenderViewHost. const GURL url("http://www.google.com"); controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); + url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); + contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(orig_rvh, contents()->GetRenderViewHost()); // Navigate to new site, simulating an onbeforeunload approval. const GURL url2("http://www.yahoo.com"); controller().LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); orig_rvh->OnMessageReceived(ViewHostMsg_ShouldClose_ACK( 0, true, base::TimeTicks(), base::TimeTicks())); EXPECT_TRUE(contents()->cross_navigation_pending()); @@ -954,7 +930,7 @@ TEST_F(WebContentsImplTest, CrossSiteCantPreemptAfterUnload) { // responding to navigation requests. (See bug 23942.) ViewHostMsg_FrameNavigate_Params params1a; InitNavigateParams(¶ms1a, 2, GURL("http://www.google.com/foo"), - content::PAGE_TRANSITION_TYPED); + PAGE_TRANSITION_TYPED); orig_rvh->SendNavigate(2, GURL("http://www.google.com/foo")); // Verify that the pending navigation is still in progress. @@ -963,7 +939,7 @@ TEST_F(WebContentsImplTest, CrossSiteCantPreemptAfterUnload) { // DidNavigate from the pending page should commit it. contents()->TestDidNavigate( - pending_rvh, 1, url2, content::PAGE_TRANSITION_TYPED); + pending_rvh, 1, url2, PAGE_TRANSITION_TYPED); SiteInstance* instance2 = contents()->GetSiteInstance(); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(pending_rvh, rvh()); @@ -981,15 +957,14 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationCanceled) { // Navigate to URL. First URL should use first RenderViewHost. const GURL url("http://www.google.com"); controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); + url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); + contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(orig_rvh, contents()->GetRenderViewHost()); // Navigate to new site, simulating an onbeforeunload approval. const GURL url2("http://www.yahoo.com"); - controller().LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller().LoadURL(url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); EXPECT_TRUE(orig_rvh->is_waiting_for_beforeunload_ack()); orig_rvh->OnMessageReceived(ViewHostMsg_ShouldClose_ACK( 0, true, base::TimeTicks(), base::TimeTicks())); @@ -1000,8 +975,7 @@ TEST_F(WebContentsImplTest, CrossSiteNavigationCanceled) { // Suppose the navigation doesn't get a chance to commit, and the user // navigates in the current RVH's SiteInstance. - controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller().LoadURL(url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); // Verify that the pending navigation is cancelled and the renderer is no // longer swapped out. @@ -1021,32 +995,29 @@ TEST_F(WebContentsImplTest, NavigationEntryContentState) { // Navigate to URL. There should be no committed entry yet. const GURL url("http://www.google.com"); - controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller().LoadURL(url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); NavigationEntry* entry = controller().GetLastCommittedEntry(); EXPECT_TRUE(entry == NULL); // Committed entry should have content state after DidNavigate. - contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); entry = controller().GetLastCommittedEntry(); EXPECT_FALSE(entry->GetContentState().empty()); // Navigate to same site. const GURL url2("http://images.google.com"); - controller().LoadURL( - url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller().LoadURL(url2, Referrer(), PAGE_TRANSITION_TYPED, std::string()); entry = controller().GetLastCommittedEntry(); EXPECT_FALSE(entry->GetContentState().empty()); // Committed entry should have content state after DidNavigate. - contents()->TestDidNavigate( - orig_rvh, 2, url2, content::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rvh, 2, url2, PAGE_TRANSITION_TYPED); entry = controller().GetLastCommittedEntry(); EXPECT_FALSE(entry->GetContentState().empty()); // Now go back. Committed entry should still have content state. controller().GoBack(); - contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); entry = controller().GetLastCommittedEntry(); EXPECT_FALSE(entry->GetContentState().empty()); } @@ -1060,8 +1031,8 @@ TEST_F(WebContentsImplTest, NavigationEntryContentStateNewWindow) { // When opening a new window, it is navigated to about:blank internally. // Currently, this results in two DidNavigate events. const GURL url(chrome::kAboutBlankURL); - contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); - contents()->TestDidNavigate(orig_rvh, 1, url, content::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rvh, 1, url, PAGE_TRANSITION_TYPED); // Should have a content state here. NavigationEntry* entry = controller().GetLastCommittedEntry(); @@ -1075,12 +1046,11 @@ TEST_F(WebContentsImplTest, NavigationEntryContentStateNewWindow) { // Navigating to a normal page should not cause a process swap. const GURL new_url("http://www.google.com"); - controller().LoadURL(new_url, content::Referrer(), - content::PAGE_TRANSITION_TYPED, std::string()); + controller().LoadURL(new_url, Referrer(), + PAGE_TRANSITION_TYPED, std::string()); EXPECT_FALSE(contents()->cross_navigation_pending()); EXPECT_EQ(orig_rvh, contents()->GetRenderViewHost()); - contents()->TestDidNavigate(orig_rvh, 1, new_url, - content::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(orig_rvh, 1, new_url, PAGE_TRANSITION_TYPED); NavigationEntryImpl* entry_impl2 = NavigationEntryImpl::FromNavigationEntry( controller().GetLastCommittedEntry()); EXPECT_EQ(site_instance_id, entry_impl2->site_instance()->GetId()); @@ -1102,8 +1072,8 @@ TEST_F(WebContentsImplTest, EXPECT_EQ(1, controller().GetEntryCount()); // Initiate a browser navigation that will trigger the interstitial - controller().LoadURL(GURL("http://www.evil.com"), content::Referrer(), - content::PAGE_TRANSITION_TYPED, std::string()); + controller().LoadURL(GURL("http://www.evil.com"), Referrer(), + PAGE_TRANSITION_TYPED, std::string()); // Show an interstitial. TestInterstitialPage::InterstitialState state = @@ -1239,8 +1209,8 @@ TEST_F(WebContentsImplTest, EXPECT_EQ(1, controller().GetEntryCount()); // Initiate a browser navigation that will trigger the interstitial - controller().LoadURL(GURL("http://www.evil.com"), content::Referrer(), - content::PAGE_TRANSITION_TYPED, std::string()); + controller().LoadURL(GURL("http://www.evil.com"), Referrer(), + PAGE_TRANSITION_TYPED, std::string()); // Show an interstitial. TestInterstitialPage::InterstitialState state = @@ -1683,8 +1653,7 @@ TEST_F(WebContentsImplTest, NavigateBeforeInterstitialShows) { // Let's simulate a navigation initiated from the browser before the // interstitial finishes loading. const GURL url("http://www.google.com"); - controller().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); + controller().LoadURL(url, Referrer(), PAGE_TRANSITION_TYPED, std::string()); ASSERT_FALSE(deleted); EXPECT_FALSE(interstitial->is_showing()); @@ -1775,8 +1744,7 @@ TEST_F(WebContentsImplTest, NewInterstitialDoesNotCancelPendingEntry) { // Start a navigation to a page contents()->GetController().LoadURL( - kGURL, content::Referrer(), content::PAGE_TRANSITION_TYPED, - std::string()); + kGURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); // Simulate that navigation triggering an interstitial. TestInterstitialPage::InterstitialState state = @@ -1791,8 +1759,7 @@ TEST_F(WebContentsImplTest, NewInterstitialDoesNotCancelPendingEntry) { // Initiate a new navigation from the browser that also triggers an // interstitial. contents()->GetController().LoadURL( - kGURL, content::Referrer(), content::PAGE_TRANSITION_TYPED, - std::string()); + kGURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); TestInterstitialPage::InterstitialState state2 = TestInterstitialPage::UNDECIDED; bool deleted2 = false; @@ -1822,10 +1789,9 @@ TEST_F(WebContentsImplTest, NoJSMessageOnInterstitials) { // Start a navigation to a page contents()->GetController().LoadURL( - kGURL, content::Referrer(), content::PAGE_TRANSITION_TYPED, - std::string()); + kGURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); // DidNavigate from the page - contents()->TestDidNavigate(rvh(), 1, kGURL, content::PAGE_TRANSITION_TYPED); + contents()->TestDidNavigate(rvh(), 1, kGURL, PAGE_TRANSITION_TYPED); // Simulate showing an interstitial while the page is showing. TestInterstitialPage::InterstitialState state = @@ -1843,7 +1809,7 @@ TEST_F(WebContentsImplTest, NoJSMessageOnInterstitials) { bool did_suppress_message = false; contents()->RunJavaScriptMessage(contents()->GetRenderViewHost(), ASCIIToUTF16("This is an informative message"), ASCIIToUTF16("OK"), - kGURL, content::JAVASCRIPT_MESSAGE_TYPE_ALERT, dummy_message, + kGURL, JAVASCRIPT_MESSAGE_TYPE_ALERT, dummy_message, &did_suppress_message); EXPECT_TRUE(did_suppress_message); } @@ -1857,8 +1823,8 @@ TEST_F(WebContentsImplTest, CopyStateFromAndPruneSourceInterstitial) { EXPECT_EQ(1, controller().GetEntryCount()); // Initiate a browser navigation that will trigger the interstitial - controller().LoadURL(GURL("http://www.evil.com"), content::Referrer(), - content::PAGE_TRANSITION_TYPED, std::string()); + controller().LoadURL(GURL("http://www.evil.com"), Referrer(), + PAGE_TRANSITION_TYPED, std::string()); // Show an interstitial. TestInterstitialPage::InterstitialState state = @@ -1946,3 +1912,5 @@ TEST_F(WebContentsImplTest, CopyStateFromAndPruneTargetInterstitial) { EXPECT_TRUE(static_cast<InterstitialPageImpl*>( other_contents->GetInterstitialPage())->reload_on_dont_proceed()); } + +} // namespace content diff --git a/content/browser/web_contents/web_contents_view_android.cc b/content/browser/web_contents/web_contents_view_android.cc index 2e74b1f..2ab1438 100644 --- a/content/browser/web_contents/web_contents_view_android.cc +++ b/content/browser/web_contents/web_contents_view_android.cc @@ -154,7 +154,7 @@ gfx::Rect WebContentsViewAndroid::GetViewBounds() const { void WebContentsViewAndroid::ShowContextMenu( const ContextMenuParams& params, - content::ContextMenuSourceType type) { + ContextMenuSourceType type) { if (delegate_.get()) delegate_->ShowContextMenu(params, type); } diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index ac79b29..1e81d5a 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc @@ -44,21 +44,20 @@ WebContentsView* CreateWebContentsView( *render_view_host_delegate_view = rv; return rv; } -} namespace { // Listens to all mouse drag events during a drag and drop and sends them to // the renderer. class WebDragSourceAura : public MessageLoopForUI::Observer, - public content::NotificationObserver { + public NotificationObserver { public: WebDragSourceAura(aura::Window* window, WebContentsImpl* contents) : window_(window), contents_(contents) { MessageLoopForUI::current()->AddObserver(this); - registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, - content::Source<content::WebContents>(contents)); + registrar_.Add(this, NOTIFICATION_WEB_CONTENTS_DISCONNECTED, + Source<WebContents>(contents)); } virtual ~WebDragSourceAura() { @@ -74,13 +73,13 @@ class WebDragSourceAura : public MessageLoopForUI::Observer, if (!contents_) return; ui::EventType type = ui::EventTypeFromNative(event); - content::RenderViewHost* rvh = NULL; + RenderViewHost* rvh = NULL; switch (type) { case ui::ET_MOUSE_DRAGGED: rvh = contents_->GetRenderViewHost(); if (rvh) { gfx::Point screen_loc_in_pixel = ui::EventLocationFromNative(event); - gfx::Point screen_loc = content::ConvertPointToDIP(rvh->GetView(), + gfx::Point screen_loc = ConvertPointToDIP(rvh->GetView(), screen_loc_in_pixel); gfx::Point client_loc = screen_loc; aura::Window* window = rvh->GetView()->GetNativeView(); @@ -96,9 +95,9 @@ class WebDragSourceAura : public MessageLoopForUI::Observer, } virtual void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) OVERRIDE { - if (type != content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED) + const NotificationSource& source, + const NotificationDetails& details) OVERRIDE { + if (type != NOTIFICATION_WEB_CONTENTS_DISCONNECTED) return; // Cancel the drag if it is still in progress. @@ -116,7 +115,7 @@ class WebDragSourceAura : public MessageLoopForUI::Observer, private: aura::Window* window_; WebContentsImpl* contents_; - content::NotificationRegistrar registrar_; + NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(WebDragSourceAura); }; @@ -237,7 +236,7 @@ int ConvertAuraEventFlagsToWebInputEventModifiers(int aura_event_flags) { WebContentsViewAura::WebContentsViewAura( WebContentsImpl* web_contents, - content::WebContentsViewDelegate* delegate) + WebContentsViewDelegate* delegate) : web_contents_(web_contents), view_(NULL), delegate_(delegate), @@ -258,7 +257,7 @@ WebContentsViewAura::~WebContentsViewAura() { void WebContentsViewAura::SizeChangedCommon(const gfx::Size& size) { if (web_contents_->GetInterstitialPage()) web_contents_->GetInterstitialPage()->SetSize(size); - content::RenderWidgetHostView* rwhv = + RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); if (rwhv) rwhv->SetSize(size); @@ -269,7 +268,7 @@ void WebContentsViewAura::EndDrag(WebKit::WebDragOperationsMask ops) { gfx::Point screen_loc = gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); gfx::Point client_loc = screen_loc; - content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); + RenderViewHost* rvh = web_contents_->GetRenderViewHost(); aura::Window* window = rvh->GetView()->GetNativeView(); aura::Window::ConvertPointToTarget(root_window, window, &client_loc); rvh->DragSourceEndedAt(client_loc.x(), client_loc.y(), screen_loc.x(), @@ -300,8 +299,8 @@ void WebContentsViewAura::CreateView(const gfx::Size& initial_size) { drag_dest_delegate_ = delegate_->GetDragDestDelegate(); } -content::RenderWidgetHostView* WebContentsViewAura::CreateViewForWidget( - content::RenderWidgetHost* render_widget_host) { +RenderWidgetHostView* WebContentsViewAura::CreateViewForWidget( + RenderWidgetHost* render_widget_host) { if (render_widget_host->GetView()) { // During testing, the view will already be set up in most cases to the // test view, so we don't want to clobber it with a real one. To verify that @@ -312,7 +311,7 @@ content::RenderWidgetHostView* WebContentsViewAura::CreateViewForWidget( return render_widget_host->GetView(); } - view_ = content::RenderWidgetHostView::CreateViewForWidget( + view_ = RenderWidgetHostView::CreateViewForWidget( render_widget_host); view_->InitAsChild(NULL); GetNativeView()->AddChild(view_->GetNativeView()); @@ -364,7 +363,7 @@ void WebContentsViewAura::SizeContents(const gfx::Size& size) { } } -void WebContentsViewAura::RenderViewCreated(content::RenderViewHost* host) { +void WebContentsViewAura::RenderViewCreated(RenderViewHost* host) { } void WebContentsViewAura::Focus() { @@ -376,8 +375,7 @@ void WebContentsViewAura::Focus() { if (delegate_.get() && delegate_->Focus()) return; - content::RenderWidgetHostView* rwhv = - web_contents_->GetRenderWidgetHostView(); + RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); if (rwhv) rwhv->Focus(); } @@ -418,8 +416,8 @@ gfx::Rect WebContentsViewAura::GetViewBounds() const { // WebContentsViewAura, RenderViewHostDelegateView implementation: void WebContentsViewAura::ShowContextMenu( - const content::ContextMenuParams& params, - content::ContextMenuSourceType type) { + const ContextMenuParams& params, + ContextMenuSourceType type) { if (delegate_.get()) delegate_->ShowContextMenu(params, type); } @@ -689,3 +687,5 @@ int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) { drag_dest_delegate_->OnDrop(); return current_drag_op_; } + +} // namespace content diff --git a/content/browser/web_contents/web_contents_view_aura.h b/content/browser/web_contents/web_contents_view_aura.h index cba65d7..64ff440 100644 --- a/content/browser/web_contents/web_contents_view_aura.h +++ b/content/browser/web_contents/web_contents_view_aura.h @@ -15,29 +15,27 @@ #include "ui/aura/client/drag_drop_delegate.h" #include "ui/aura/window_delegate.h" -class WebContentsImpl; - namespace aura { class Window; } -namespace content { -class WebContentsViewDelegate; -class WebDragDestDelegate; -} - namespace ui { class DropTargetEvent; } +namespace content { +class WebContentsViewDelegate; +class WebContentsImpl; +class WebDragDestDelegate; + class CONTENT_EXPORT WebContentsViewAura - : public content::WebContentsView, - public content::RenderViewHostDelegateView, + : public WebContentsView, + public RenderViewHostDelegateView, public aura::WindowDelegate, public aura::client::DragDropDelegate { public: WebContentsViewAura(WebContentsImpl* web_contents, - content::WebContentsViewDelegate* delegate); + WebContentsViewDelegate* delegate); private: virtual ~WebContentsViewAura(); @@ -48,8 +46,8 @@ class CONTENT_EXPORT WebContentsViewAura // Overridden from WebContentsView: virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; - virtual content::RenderWidgetHostView* CreateViewForWidget( - content::RenderWidgetHost* render_widget_host) OVERRIDE; + virtual RenderWidgetHostView* CreateViewForWidget( + RenderWidgetHost* render_widget_host) OVERRIDE; virtual gfx::NativeView GetNativeView() const OVERRIDE; virtual gfx::NativeView GetContentNativeView() const OVERRIDE; virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; @@ -58,7 +56,7 @@ class CONTENT_EXPORT WebContentsViewAura virtual void OnTabCrashed(base::TerminationStatus status, int error_code) OVERRIDE; virtual void SizeContents(const gfx::Size& size) OVERRIDE; - virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE; + virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE; virtual void Focus() OVERRIDE; virtual void SetInitialFocus() OVERRIDE; virtual void StoreFocus() OVERRIDE; @@ -70,8 +68,8 @@ class CONTENT_EXPORT WebContentsViewAura // Overridden from RenderViewHostDelegateView: virtual void ShowContextMenu( - const content::ContextMenuParams& params, - content::ContextMenuSourceType type) OVERRIDE; + const ContextMenuParams& params, + ContextMenuSourceType type) OVERRIDE; virtual void ShowPopupMenu(const gfx::Rect& bounds, int item_height, double item_font_size, @@ -126,13 +124,13 @@ class CONTENT_EXPORT WebContentsViewAura // The WebContentsImpl whose contents we display. WebContentsImpl* web_contents_; - content::RenderWidgetHostView* view_; + RenderWidgetHostView* view_; - scoped_ptr<content::WebContentsViewDelegate> delegate_; + scoped_ptr<WebContentsViewDelegate> delegate_; WebKit::WebDragOperationsMask current_drag_op_; - content::WebDragDestDelegate* drag_dest_delegate_; + WebDragDestDelegate* drag_dest_delegate_; // We keep track of the render view host we're dragging over. If it changes // during a drag, we need to re-send the DragEnter message. WARNING: @@ -143,4 +141,6 @@ class CONTENT_EXPORT WebContentsViewAura DISALLOW_COPY_AND_ASSIGN(WebContentsViewAura); }; +} // namespace content + #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_AURA_H_ diff --git a/content/browser/web_contents/web_contents_view_gtk.cc b/content/browser/web_contents/web_contents_view_gtk.cc index 20b1239..a2f3524 100644 --- a/content/browser/web_contents/web_contents_view_gtk.cc +++ b/content/browser/web_contents/web_contents_view_gtk.cc @@ -31,9 +31,8 @@ using WebKit::WebDragOperation; using WebKit::WebDragOperationsMask; -using content::RenderWidgetHost; -using content::WebContents; +namespace content { namespace { // Called when the mouse leaves the widget. We notify our delegate. @@ -62,7 +61,7 @@ gboolean OnMouseScroll(GtkWidget* widget, GdkEventScroll* event, return FALSE; } - content::WebContentsDelegate* delegate = web_contents->GetDelegate(); + WebContentsDelegate* delegate = web_contents->GetDelegate(); if (!delegate) return FALSE; @@ -77,8 +76,6 @@ gboolean OnMouseScroll(GtkWidget* widget, GdkEventScroll* event, } // namespace -namespace content { - WebContentsView* CreateWebContentsView( WebContentsImpl* web_contents, WebContentsViewDelegate* delegate, @@ -90,7 +87,7 @@ WebContentsView* CreateWebContentsView( WebContentsViewGtk::WebContentsViewGtk( WebContentsImpl* web_contents, - content::WebContentsViewDelegate* delegate) + WebContentsViewDelegate* delegate) : web_contents_(web_contents), expanded_(gtk_expanded_container_new()), delegate_(delegate) { @@ -101,7 +98,7 @@ WebContentsViewGtk::WebContentsViewGtk( G_CALLBACK(OnChildSizeRequestThunk), this); gtk_widget_show(expanded_.get()); - drag_source_.reset(new content::WebDragSourceGtk(web_contents)); + drag_source_.reset(new WebDragSourceGtk(web_contents)); if (delegate_.get()) delegate_->Initialize(expanded_.get(), &focus_store_); @@ -143,7 +140,7 @@ RenderWidgetHostView* WebContentsViewGtk::CreateViewForWidget( InsertIntoContentArea(content_view); // Renderer target DnD. - drag_dest_.reset(new content::WebDragDestGtk(web_contents_, content_view)); + drag_dest_.reset(new WebDragDestGtk(web_contents_, content_view)); if (delegate_.get()) drag_dest_->set_delegate(delegate_->GetDragDestDelegate()); @@ -213,7 +210,7 @@ void WebContentsViewGtk::SizeContents(const gfx::Size& size) { rwhv->SetSize(size); } -void WebContentsViewGtk::RenderViewCreated(content::RenderViewHost* host) { +void WebContentsViewGtk::RenderViewCreated(RenderViewHost* host) { } void WebContentsViewGtk::Focus() { @@ -321,8 +318,8 @@ gboolean WebContentsViewGtk::OnFocus(GtkWidget* widget, } void WebContentsViewGtk::ShowContextMenu( - const content::ContextMenuParams& params, - content::ContextMenuSourceType type) { + const ContextMenuParams& params, + ContextMenuSourceType type) { if (delegate_.get()) delegate_->ShowContextMenu(params, type); else diff --git a/content/browser/web_contents/web_contents_view_gtk.h b/content/browser/web_contents/web_contents_view_gtk.h index f8cbeb9..5ece503 100644 --- a/content/browser/web_contents/web_contents_view_gtk.h +++ b/content/browser/web_contents/web_contents_view_gtk.h @@ -17,11 +17,10 @@ #include "ui/base/gtk/gtk_signal.h" #include "ui/base/gtk/owned_widget_gtk.h" -class WebContentsImpl; - namespace content { class WebContents; +class WebContentsImpl; class WebContentsViewDelegate; class WebDragDestDelegate; class WebDragDestGtk; @@ -46,9 +45,8 @@ class CONTENT_EXPORT WebContentsViewGtk // WebContentsView implementation -------------------------------------------- virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; - virtual content::RenderWidgetHostView* CreateViewForWidget( - content::RenderWidgetHost* render_widget_host) OVERRIDE; - + virtual RenderWidgetHostView* CreateViewForWidget( + RenderWidgetHost* render_widget_host) OVERRIDE; virtual gfx::NativeView GetNativeView() const OVERRIDE; virtual gfx::NativeView GetContentNativeView() const OVERRIDE; virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; @@ -57,7 +55,7 @@ class CONTENT_EXPORT WebContentsViewGtk virtual void OnTabCrashed(base::TerminationStatus status, int error_code) OVERRIDE; virtual void SizeContents(const gfx::Size& size) OVERRIDE; - virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE; + virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE; virtual void Focus() OVERRIDE; virtual void SetInitialFocus() OVERRIDE; virtual void StoreFocus() OVERRIDE; @@ -69,8 +67,8 @@ class CONTENT_EXPORT WebContentsViewGtk // Backend implementation of RenderViewHostDelegateView. virtual void ShowContextMenu( - const content::ContextMenuParams& params, - content::ContextMenuSourceType type) OVERRIDE; + const ContextMenuParams& params, + ContextMenuSourceType type) OVERRIDE; virtual void ShowPopupMenu(const gfx::Rect& bounds, int item_height, double item_font_size, diff --git a/content/browser/web_contents/web_contents_view_mac.h b/content/browser/web_contents/web_contents_view_mac.h index fe774e4..cce1cc6 100644 --- a/content/browser/web_contents/web_contents_view_mac.h +++ b/content/browser/web_contents/web_contents_view_mac.h @@ -19,12 +19,12 @@ @class FocusTracker; class SkBitmap; -class WebContentsImpl; class WebContentsViewMac; @class WebDragDest; @class WebDragSource; namespace content { +class WebContentsImpl; class WebContentsViewDelegate; } @@ -44,7 +44,7 @@ class Point; // Expose this, since sometimes one needs both the NSView and the // WebContentsImpl. -- (WebContentsImpl*)webContents; +- (content::WebContentsImpl*)webContents; @end // Mac-specific implementation of the WebContentsView. It owns an NSView that @@ -56,7 +56,7 @@ class WebContentsViewMac // The corresponding WebContentsImpl is passed in the constructor, and manages // our lifetime. This doesn't need to be the case, but is this way currently // because that's what was easiest when they were split. - WebContentsViewMac(WebContentsImpl* web_contents, + WebContentsViewMac(content::WebContentsImpl* web_contents, content::WebContentsViewDelegate* delegate); virtual ~WebContentsViewMac(); @@ -106,12 +106,12 @@ class WebContentsViewMac // CloseTabAfterEventTracking() implementation. void CloseTab(); - WebContentsImpl* web_contents() { return web_contents_; } + content::WebContentsImpl* web_contents() { return web_contents_; } content::WebContentsViewDelegate* delegate() { return delegate_.get(); } private: // The WebContentsImpl whose contents we display. - WebContentsImpl* web_contents_; + content::WebContentsImpl* web_contents_; // The Cocoa NSView that lives in the view hierarchy. scoped_nsobject<WebContentsViewCocoa> cocoa_view_; diff --git a/content/browser/web_contents/web_contents_view_mac.mm b/content/browser/web_contents/web_contents_view_mac.mm index 94cd0d8..b69a62e 100644 --- a/content/browser/web_contents/web_contents_view_mac.mm +++ b/content/browser/web_contents/web_contents_view_mac.mm @@ -34,6 +34,7 @@ using content::PopupMenuHelper; using content::RenderWidgetHostView; using content::RenderWidgetHostViewMac; using content::WebContents; +using content::WebContentsImpl; // Ensure that the WebKit::WebDragOperation enum values stay in sync with // NSDragOperation constants, since the code below static_casts between 'em. diff --git a/content/browser/web_contents/web_contents_view_win.cc b/content/browser/web_contents/web_contents_view_win.cc index 70d6b84..d604176 100644 --- a/content/browser/web_contents/web_contents_view_win.cc +++ b/content/browser/web_contents/web_contents_view_win.cc @@ -19,12 +19,6 @@ #include "ui/base/win/hwnd_subclass.h" #include "ui/gfx/screen.h" -using content::RenderViewHost; -using content::RenderWidgetHostView; -using content::RenderWidgetHostViewWin; -using content::WebContents; -using content::WebContentsViewDelegate; - namespace content { WebContentsView* CreateWebContentsView( WebContentsImpl* web_contents, @@ -34,7 +28,6 @@ WebContentsView* CreateWebContentsView( *render_view_host_delegate_view = rv; return rv; } -} namespace { @@ -120,14 +113,14 @@ void WebContentsViewWin::CreateView(const gfx::Size& initial_size) { RevokeDragDrop(GetNativeView()); drag_dest_ = new WebDragDest(hwnd(), web_contents_); if (delegate_.get()) { - content::WebDragDestDelegate* delegate = delegate_->GetDragDestDelegate(); + WebDragDestDelegate* delegate = delegate_->GetDragDestDelegate(); if (delegate) drag_dest_->set_delegate(delegate); } } RenderWidgetHostView* WebContentsViewWin::CreateViewForWidget( - content::RenderWidgetHost* render_widget_host) { + RenderWidgetHost* render_widget_host) { if (render_widget_host->GetView()) { // During testing, the view will already be set up in most cases to the // test view, so we don't want to clobber it with a real one. To verify that @@ -250,8 +243,8 @@ gfx::Rect WebContentsViewWin::GetViewBounds() const { } void WebContentsViewWin::ShowContextMenu( - const content::ContextMenuParams& params, - content::ContextMenuSourceType type) { + const ContextMenuParams& params, + ContextMenuSourceType type) { if (delegate_.get()) delegate_->ShowContextMenu(params, type); } @@ -483,3 +476,5 @@ LRESULT WebContentsViewWin::OnSize( return 1; } + +} // namespace content diff --git a/content/browser/web_contents/web_contents_view_win.h b/content/browser/web_contents/web_contents_view_win.h index 9d7b8ff..35351dd 100644 --- a/content/browser/web_contents/web_contents_view_win.h +++ b/content/browser/web_contents/web_contents_view_win.h @@ -16,25 +16,24 @@ class WebDragDest; class WebContentsDragWin; -class WebContentsImpl; - -namespace content { -class RenderWidgetHostViewWin; -class WebContentsViewDelegate; -} namespace ui { class HWNDMessageFilter; } +namespace content { +class RenderWidgetHostViewWin; +class WebContentsViewDelegate; +class WebContentsImpl; + // An implementation of WebContentsView for Windows. class CONTENT_EXPORT WebContentsViewWin - : public content::WebContentsView, - public content::RenderViewHostDelegateView, + : public WebContentsView, + public RenderViewHostDelegateView, public ui::WindowImpl { public: WebContentsViewWin(WebContentsImpl* web_contents, - content::WebContentsViewDelegate* delegate); + WebContentsViewDelegate* delegate); virtual ~WebContentsViewWin(); BEGIN_MSG_MAP_EX(WebContentsViewWin) @@ -56,8 +55,8 @@ class CONTENT_EXPORT WebContentsViewWin // Overridden from WebContentsView: virtual void CreateView(const gfx::Size& initial_size) OVERRIDE; - virtual content::RenderWidgetHostView* CreateViewForWidget( - content::RenderWidgetHost* render_widget_host) OVERRIDE; + virtual RenderWidgetHostView* CreateViewForWidget( + RenderWidgetHost* render_widget_host) OVERRIDE; virtual gfx::NativeView GetNativeView() const OVERRIDE; virtual gfx::NativeView GetContentNativeView() const OVERRIDE; virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE; @@ -66,7 +65,7 @@ class CONTENT_EXPORT WebContentsViewWin virtual void OnTabCrashed(base::TerminationStatus status, int error_code) OVERRIDE; virtual void SizeContents(const gfx::Size& size) OVERRIDE; - virtual void RenderViewCreated(content::RenderViewHost* host) OVERRIDE; + virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE; virtual void Focus() OVERRIDE; virtual void SetInitialFocus() OVERRIDE; virtual void StoreFocus() OVERRIDE; @@ -78,8 +77,8 @@ class CONTENT_EXPORT WebContentsViewWin // Implementation of RenderViewHostDelegateView. virtual void ShowContextMenu( - const content::ContextMenuParams& params, - content::ContextMenuSourceType type) OVERRIDE; + const ContextMenuParams& params, + ContextMenuSourceType type) OVERRIDE; virtual void ShowPopupMenu(const gfx::Rect& bounds, int item_height, double item_font_size, @@ -127,9 +126,9 @@ class CONTENT_EXPORT WebContentsViewWin // The WebContentsImpl whose contents we display. WebContentsImpl* web_contents_; - content::RenderWidgetHostViewWin* view_; + RenderWidgetHostViewWin* view_; - scoped_ptr<content::WebContentsViewDelegate> delegate_; + scoped_ptr<WebContentsViewDelegate> delegate_; // The helper object that handles drag destination related interactions with // Windows. @@ -143,4 +142,6 @@ class CONTENT_EXPORT WebContentsViewWin DISALLOW_COPY_AND_ASSIGN(WebContentsViewWin); }; +} // namespace content + #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_WIN_H_ diff --git a/content/browser/web_contents/web_drag_dest_mac.h b/content/browser/web_contents/web_drag_dest_mac.h index 0340cfd..4358e2b 100644 --- a/content/browser/web_contents/web_drag_dest_mac.h +++ b/content/browser/web_contents/web_drag_dest_mac.h @@ -8,10 +8,10 @@ #include "base/string16.h" #include "webkit/glue/webdropdata.h" -class WebContentsImpl; namespace content { class RenderViewHost; +class WebContentsImpl; class WebDragDestDelegate; } @@ -25,7 +25,7 @@ typedef content::RenderViewHost* RenderViewHostIdentifier; @interface WebDragDest : NSObject { @private // Our associated WebContentsImpl. Weak reference. - WebContentsImpl* webContents_; + content::WebContentsImpl* webContents_; // Delegate; weak. content::WebDragDestDelegate* delegate_; @@ -45,7 +45,7 @@ typedef content::RenderViewHost* RenderViewHostIdentifier; // |contents| is the WebContentsImpl representing this tab, used to communicate // drag&drop messages to WebCore and handle navigation on a successful drop // (if necessary). -- (id)initWithWebContentsImpl:(WebContentsImpl*)contents; +- (id)initWithWebContentsImpl:(content::WebContentsImpl*)contents; - (WebDropData*)currentDropData; diff --git a/content/browser/web_contents/web_drag_dest_mac.mm b/content/browser/web_contents/web_drag_dest_mac.mm index 02bf7f2c..5770ce8 100644 --- a/content/browser/web_contents/web_drag_dest_mac.mm +++ b/content/browser/web_contents/web_drag_dest_mac.mm @@ -20,6 +20,7 @@ using WebKit::WebDragOperationsMask; using content::OpenURLParams; using content::Referrer; +using content::WebContentsImpl; int GetModifierFlags() { int modifier_state = 0; diff --git a/content/browser/web_contents/web_drag_source_mac.h b/content/browser/web_contents/web_drag_source_mac.h index b376a22..8c83349 100644 --- a/content/browser/web_contents/web_drag_source_mac.h +++ b/content/browser/web_contents/web_drag_source_mac.h @@ -9,15 +9,17 @@ #include "base/memory/scoped_ptr.h" #include "googleurl/src/gurl.h" -class WebContentsImpl; struct WebDropData; +namespace content { +class WebContentsImpl; +} // A class that handles tracking and event processing for a drag and drop // originating from the content area. @interface WebDragSource : NSObject { @private // Our contents. Weak reference (owns or co-owns us). - WebContentsImpl* contents_; + content::WebContentsImpl* contents_; // The view from which the drag was initiated. Weak reference. NSView* contentsView_; @@ -50,7 +52,7 @@ struct WebDropData; // Initialize a WebDragSource object for a drag (originating on the given // contentsView and with the given dropData and pboard). Fill the pasteboard // with data types appropriate for dropData. -- (id)initWithContents:(WebContentsImpl*)contents +- (id)initWithContents:(content::WebContentsImpl*)contents view:(NSView*)contentsView dropData:(const WebDropData*)dropData image:(NSImage*)image diff --git a/content/browser/web_contents/web_drag_source_mac.mm b/content/browser/web_contents/web_drag_source_mac.mm index 3de112d..1d21e30 100644 --- a/content/browser/web_contents/web_drag_source_mac.mm +++ b/content/browser/web_contents/web_drag_source_mac.mm @@ -102,7 +102,7 @@ void PromiseWriterHelper(const WebDropData& drop_data, @implementation WebDragSource -- (id)initWithContents:(WebContentsImpl*)contents +- (id)initWithContents:(content::WebContentsImpl*)contents view:(NSView*)contentsView dropData:(const WebDropData*)dropData image:(NSImage*)image diff --git a/content/common/edit_command.h b/content/common/edit_command.h index 795e5b2..d7c3032 100644 --- a/content/common/edit_command.h +++ b/content/common/edit_command.h @@ -8,6 +8,8 @@ #include <string> #include <vector> +namespace content { + // Types related to sending edit commands to the renderer. struct EditCommand { EditCommand() { } @@ -21,4 +23,6 @@ struct EditCommand { typedef std::vector<EditCommand> EditCommands; +} // namespace content + #endif // CONTENT_COMMON_EDIT_COMMAND_H_ diff --git a/content/common/navigation_gesture.h b/content/common/navigation_gesture.h index 1f37c4a..5040d71 100644 --- a/content/common/navigation_gesture.h +++ b/content/common/navigation_gesture.h @@ -5,6 +5,8 @@ #ifndef CONTENT_COMMON_NAVIGATION_GESTURE_H_ #define CONTENT_COMMON_NAVIGATION_GESTURE_H_ +namespace content { + enum NavigationGesture { // User initiated navigation/load. NavigationGestureUser, @@ -16,4 +18,6 @@ enum NavigationGesture { NavigationGestureUnknown, }; +} // namespace content + #endif // CONTENT_COMMON_NAVIGATION_GESTURE_H_ diff --git a/content/common/view_messages.h b/content/common/view_messages.h index 72b4e2e..8393662 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -59,7 +59,6 @@ #define IPC_MESSAGE_START ViewMsgStart IPC_ENUM_TRAITS(AccessibilityMode) -IPC_ENUM_TRAITS(NavigationGesture) IPC_ENUM_TRAITS(ViewMsg_Navigate_Type::Value) IPC_ENUM_TRAITS(WebKit::WebContextMenuData::MediaType) IPC_ENUM_TRAITS(WebKit::WebMediaPlayerAction::Type) @@ -70,6 +69,7 @@ IPC_ENUM_TRAITS(WebMenuItem::Type) IPC_ENUM_TRAITS(WindowContainerType) IPC_ENUM_TRAITS(content::FileChooserParams::Mode) IPC_ENUM_TRAITS(content::JavaScriptMessageType) +IPC_ENUM_TRAITS(content::NavigationGesture) IPC_ENUM_TRAITS(content::PageZoom) IPC_ENUM_TRAITS(content::RendererPreferencesHintingEnum) IPC_ENUM_TRAITS(content::RendererPreferencesSubpixelRenderingEnum) @@ -78,11 +78,6 @@ IPC_ENUM_TRAITS(media::ChannelLayout) IPC_ENUM_TRAITS(media::MediaLogEvent::Type) IPC_ENUM_TRAITS(ui::TextInputType) -IPC_STRUCT_TRAITS_BEGIN(EditCommand) - IPC_STRUCT_TRAITS_MEMBER(name) - IPC_STRUCT_TRAITS_MEMBER(value) -IPC_STRUCT_TRAITS_END() - #if defined(OS_MACOSX) IPC_STRUCT_TRAITS_BEGIN(FontDescriptor) IPC_STRUCT_TRAITS_MEMBER(font_name) @@ -285,6 +280,11 @@ IPC_STRUCT_TRAITS_BEGIN(content::CustomContextMenuContext) IPC_STRUCT_TRAITS_MEMBER(render_widget_id) IPC_STRUCT_TRAITS_END() +IPC_STRUCT_TRAITS_BEGIN(content::EditCommand) + IPC_STRUCT_TRAITS_MEMBER(name) + IPC_STRUCT_TRAITS_MEMBER(value) +IPC_STRUCT_TRAITS_END() + IPC_STRUCT_TRAITS_BEGIN(content::FileChooserParams) IPC_STRUCT_TRAITS_MEMBER(mode) IPC_STRUCT_TRAITS_MEMBER(title) @@ -479,7 +479,7 @@ IPC_STRUCT_BEGIN_WITH_PARENT(ViewHostMsg_FrameNavigate_Params, IPC_STRUCT_MEMBER(std::string, security_info) // The gesture that initiated this navigation. - IPC_STRUCT_MEMBER(NavigationGesture, gesture) + IPC_STRUCT_MEMBER(content::NavigationGesture, gesture) // True if this was a post request. IPC_STRUCT_MEMBER(bool, is_post) @@ -941,7 +941,7 @@ IPC_MESSAGE_ROUTED1(ViewMsg_SmoothScrollCompleted, // // This message must be sent just before sending a key event. IPC_MESSAGE_ROUTED1(ViewMsg_SetEditCommandsForNextKeyEvent, - std::vector<EditCommand> /* edit_commands */) + std::vector<content::EditCommand> /* edit_commands */) // Message payload is the name/value of a WebCore edit command to execute. IPC_MESSAGE_ROUTED2(ViewMsg_ExecuteEditCommand, diff --git a/content/common/web_database_observer_impl.cc b/content/common/web_database_observer_impl.cc index 7673c53..d8483cd 100644 --- a/content/common/web_database_observer_impl.cc +++ b/content/common/web_database_observer_impl.cc @@ -13,6 +13,7 @@ using WebKit::WebDatabase; +namespace content { namespace { const int kResultHistogramSize = 50; @@ -164,3 +165,5 @@ void WebDatabaseObserverImpl::HandleSqliteError( error)); } } + +} // namespace content diff --git a/content/common/web_database_observer_impl.h b/content/common/web_database_observer_impl.h index 862e8d0..7496cac 100644 --- a/content/common/web_database_observer_impl.h +++ b/content/common/web_database_observer_impl.h @@ -10,6 +10,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabaseObserver.h" #include "webkit/database/database_connections.h" +namespace content { + class WebDatabaseObserverImpl : public WebKit::WebDatabaseObserver { public: explicit WebDatabaseObserverImpl(IPC::SyncMessageFilter* sender); @@ -46,4 +48,6 @@ class WebDatabaseObserverImpl : public WebKit::WebDatabaseObserver { scoped_refptr<webkit_database::DatabaseConnectionsWrapper> open_connections_; }; +} // namespace content + #endif // CONTENT_COMMON_WEB_DATABASE_OBSERVER_IMPL_H_ diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index aaed0b4..4e1e587 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -23,7 +23,6 @@ class FilePath; class GURL; -class WebContentsImpl; namespace base { class ListValue; @@ -36,6 +35,7 @@ class DownloadItem; class JavaScriptDialogCreator; class RenderViewHost; class WebContents; +class WebContentsImpl; class WebIntentsDispatcher; struct ContextMenuParams; struct FileChooserParams; @@ -434,7 +434,7 @@ class CONTENT_EXPORT WebContentsDelegate { virtual ~WebContentsDelegate(); private: - friend class ::WebContentsImpl; + friend class WebContentsImpl; // Called when |this| becomes the WebContentsDelegate for |source|. void Attach(WebContents* source); diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h index 5a38806..59e0a1b 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h @@ -14,12 +14,11 @@ #include "ipc/ipc_sender.h" #include "webkit/glue/window_open_disposition.h" -class WebContentsImpl; - namespace content { class RenderViewHost; class WebContents; +class WebContentsImpl; struct FrameNavigateParams; struct LoadCommittedDetails; struct Referrer; @@ -175,7 +174,7 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener, WebContents* web_contents() const; private: - friend class ::WebContentsImpl; + friend class WebContentsImpl; // Invoked from WebContentsImpl. Invokes WebContentsDestroyed and NULL out // |web_contents_|. diff --git a/content/renderer/media/mock_peer_connection_impl.h b/content/renderer/media/mock_peer_connection_impl.h index 26f0037..1ea2728 100644 --- a/content/renderer/media/mock_peer_connection_impl.h +++ b/content/renderer/media/mock_peer_connection_impl.h @@ -34,7 +34,8 @@ class MockPeerConnectionImpl : public webrtc::PeerConnectionInterface { virtual bool SendDtmf(const webrtc::AudioTrackInterface* send_track, const std::string& tones, int duration, const webrtc::AudioTrackInterface* play_track) OVERRIDE; - virtual void RemoveStream(webrtc::MediaStreamInterface* local_stream) OVERRIDE; + virtual void RemoveStream( + webrtc::MediaStreamInterface* local_stream) OVERRIDE; virtual ReadyState ready_state() OVERRIDE; virtual bool StartIce(IceOptions options) OVERRIDE; diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index 09c824a..d2d64e6 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h @@ -22,7 +22,6 @@ #include "ui/gfx/native_widget_types.h" class SkBitmap; -class WebDatabaseObserverImpl; struct ViewMsg_New_Params; namespace WebKit { @@ -67,6 +66,7 @@ class P2PSocketDispatcher; class RendererWebKitPlatformSupportImpl; class RenderProcessObserver; class VideoCaptureImplManager; +class WebDatabaseObserverImpl; class WebGraphicsContext3DCommandBufferImpl; namespace old { diff --git a/content/worker/worker_thread.h b/content/worker/worker_thread.h index 0ac216f..aaa78a3 100644 --- a/content/worker/worker_thread.h +++ b/content/worker/worker_thread.h @@ -9,13 +9,13 @@ #include "content/common/child_thread.h" -class WebDatabaseObserverImpl; struct WorkerProcessMsg_CreateWorker_Params; namespace content { class AppCacheDispatcher; class DBMessageFilter; class IndexedDBMessageFilter; +class WebDatabaseObserverImpl; class WebSharedWorkerStub; class WorkerWebKitPlatformSupportImpl; |