diff options
48 files changed, 216 insertions, 133 deletions
diff --git a/chrome/browser/apps/app_view_browsertest.cc b/chrome/browser/apps/app_view_browsertest.cc index 44b0b0d..317bdab 100644 --- a/chrome/browser/apps/app_view_browsertest.cc +++ b/chrome/browser/apps/app_view_browsertest.cc @@ -5,24 +5,24 @@ #include "base/strings/stringprintf.h" #include "chrome/browser/apps/app_browsertest_util.h" #include "chrome/browser/extensions/extension_test_message_listener.h" -#include "chrome/browser/guest_view/guest_view_manager.h" -#include "chrome/browser/guest_view/guest_view_manager_factory.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/render_process_host.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/test_utils.h" +#include "extensions/browser/guest_view/guest_view_manager.h" +#include "extensions/browser/guest_view/guest_view_manager_factory.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_response.h" namespace { -class TestGuestViewManager : public GuestViewManager { +class TestGuestViewManager : public extensions::GuestViewManager { public: explicit TestGuestViewManager(content::BrowserContext* context) : - GuestViewManager(context), + extensions::GuestViewManager(context), web_contents_(NULL) {} content::WebContents* WaitForGuestCreated() { @@ -38,7 +38,8 @@ class TestGuestViewManager : public GuestViewManager { // GuestViewManager override: virtual void AddGuest(int guest_instance_id, content::WebContents* guest_web_contents) OVERRIDE{ - GuestViewManager::AddGuest(guest_instance_id, guest_web_contents); + extensions::GuestViewManager::AddGuest( + guest_instance_id, guest_web_contents); web_contents_ = guest_web_contents; if (message_loop_runner_) @@ -50,14 +51,14 @@ class TestGuestViewManager : public GuestViewManager { }; // Test factory for creating test instances of GuestViewManager. -class TestGuestViewManagerFactory : public GuestViewManagerFactory { +class TestGuestViewManagerFactory : public extensions::GuestViewManagerFactory { public: TestGuestViewManagerFactory() : test_guest_view_manager_(NULL) {} virtual ~TestGuestViewManagerFactory() {} - virtual GuestViewManager* CreateGuestViewManager( + virtual extensions::GuestViewManager* CreateGuestViewManager( content::BrowserContext* context) OVERRIDE { return GetManager(context); } @@ -80,7 +81,7 @@ class TestGuestViewManagerFactory : public GuestViewManagerFactory { class AppViewTest : public extensions::PlatformAppBrowserTest { public: AppViewTest() { - GuestViewManager::set_factory_for_testing(&factory_); + extensions::GuestViewManager::set_factory_for_testing(&factory_); } TestGuestViewManager* GetGuestViewManager() { diff --git a/chrome/browser/apps/web_view_browsertest.cc b/chrome/browser/apps/web_view_browsertest.cc index f1a23af..8e71fd9 100644 --- a/chrome/browser/apps/web_view_browsertest.cc +++ b/chrome/browser/apps/web_view_browsertest.cc @@ -9,8 +9,6 @@ #include "chrome/browser/apps/app_browsertest_util.h" #include "chrome/browser/chrome_content_browser_client.h" #include "chrome/browser/extensions/extension_test_message_listener.h" -#include "chrome/browser/guest_view/guest_view_manager.h" -#include "chrome/browser/guest_view/guest_view_manager_factory.h" #include "chrome/browser/prerender/prerender_link_manager.h" #include "chrome/browser/prerender/prerender_link_manager_factory.h" #include "chrome/browser/profiles/profile.h" @@ -31,6 +29,8 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/fake_speech_recognition_manager.h" #include "content/public/test/test_renderer_host.h" +#include "extensions/browser/guest_view/guest_view_manager.h" +#include "extensions/browser/guest_view/guest_view_manager_factory.h" #include "extensions/common/extension.h" #include "extensions/common/extensions_client.h" #include "media/base/media_switches.h" @@ -94,7 +94,7 @@ class TestInterstitialPageDelegate : public content::InterstitialPageDelegate { virtual std::string GetHTMLContents() OVERRIDE { return std::string(); } }; -class TestGuestViewManager : public GuestViewManager { +class TestGuestViewManager : public extensions::GuestViewManager { public: explicit TestGuestViewManager(content::BrowserContext* context) : GuestViewManager(context), @@ -113,7 +113,8 @@ class TestGuestViewManager : public GuestViewManager { // GuestViewManager override: virtual void AddGuest(int guest_instance_id, content::WebContents* guest_web_contents) OVERRIDE{ - GuestViewManager::AddGuest(guest_instance_id, guest_web_contents); + extensions::GuestViewManager::AddGuest( + guest_instance_id, guest_web_contents); web_contents_ = guest_web_contents; if (message_loop_runner_) @@ -125,14 +126,15 @@ class TestGuestViewManager : public GuestViewManager { }; // Test factory for creating test instances of GuestViewManager. -class TestGuestViewManagerFactory : public GuestViewManagerFactory { +class TestGuestViewManagerFactory : + public extensions::GuestViewManagerFactory { public: TestGuestViewManagerFactory() : test_guest_view_manager_(NULL) {} virtual ~TestGuestViewManagerFactory() {} - virtual GuestViewManager* CreateGuestViewManager( + virtual extensions::GuestViewManager* CreateGuestViewManager( content::BrowserContext* context) OVERRIDE { return GetManager(context); } @@ -727,7 +729,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest { WebViewTest() : guest_web_contents_(NULL), embedder_web_contents_(NULL) { - GuestViewManager::set_factory_for_testing(&factory_); + extensions::GuestViewManager::set_factory_for_testing(&factory_); } private: diff --git a/chrome/browser/apps/web_view_interactive_browsertest.cc b/chrome/browser/apps/web_view_interactive_browsertest.cc index 50eb428..54bec4f 100644 --- a/chrome/browser/apps/web_view_interactive_browsertest.cc +++ b/chrome/browser/apps/web_view_interactive_browsertest.cc @@ -10,9 +10,6 @@ #include "chrome/browser/apps/app_browsertest_util.h" #include "chrome/browser/chrome_content_browser_client.h" #include "chrome/browser/extensions/extension_test_message_listener.h" -#include "chrome/browser/guest_view/guest_view_base.h" -#include "chrome/browser/guest_view/guest_view_manager.h" -#include "chrome/browser/guest_view/guest_view_manager_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.h" #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h" @@ -27,6 +24,9 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" #include "content/public/test/browser_test_utils.h" +#include "extensions/browser/guest_view/guest_view_base.h" +#include "extensions/browser/guest_view/guest_view_manager.h" +#include "extensions/browser/guest_view/guest_view_manager_factory.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "ui/base/ime/composition_text.h" #include "ui/base/ime/text_input_client.h" @@ -35,7 +35,7 @@ using apps::AppWindow; -class TestGuestViewManager : public GuestViewManager { +class TestGuestViewManager : public extensions::GuestViewManager { public: explicit TestGuestViewManager(content::BrowserContext* context) : GuestViewManager(context), @@ -54,7 +54,8 @@ class TestGuestViewManager : public GuestViewManager { // GuestViewManager override: virtual void AddGuest(int guest_instance_id, content::WebContents* guest_web_contents) OVERRIDE{ - GuestViewManager::AddGuest(guest_instance_id, guest_web_contents); + extensions::GuestViewManager::AddGuest( + guest_instance_id, guest_web_contents); web_contents_ = guest_web_contents; if (message_loop_runner_) @@ -66,14 +67,14 @@ class TestGuestViewManager : public GuestViewManager { }; // Test factory for creating test instances of GuestViewManager. -class TestGuestViewManagerFactory : public GuestViewManagerFactory { +class TestGuestViewManagerFactory : public extensions::GuestViewManagerFactory { public: TestGuestViewManagerFactory() : test_guest_view_manager_(NULL) {} virtual ~TestGuestViewManagerFactory() {} - virtual GuestViewManager* CreateGuestViewManager( + virtual extensions::GuestViewManager* CreateGuestViewManager( content::BrowserContext* context) OVERRIDE { return GetManager(context); } @@ -100,7 +101,7 @@ class WebViewInteractiveTest corner_(gfx::Point()), mouse_click_result_(false), first_click_(true) { - GuestViewManager::set_factory_for_testing(&factory_); + extensions::GuestViewManager::set_factory_for_testing(&factory_); } TestGuestViewManager* GetGuestViewManager() { @@ -286,7 +287,7 @@ class WebViewInteractiveTest guest_web_contents_ = source->GetWebContents(); embedder_web_contents_ = - GuestViewBase::FromWebContents(guest_web_contents_)-> + extensions::GuestViewBase::FromWebContents(guest_web_contents_)-> embedder_web_contents(); gfx::Rect offset = embedder_web_contents_->GetContainerBounds(); diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 0dfe5de..1c942ab 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -222,12 +222,12 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/suggest_permission_util.h" -#include "chrome/browser/guest_view/guest_view_base.h" -#include "chrome/browser/guest_view/guest_view_manager.h" #include "chrome/browser/guest_view/web_view/web_view_guest.h" #include "chrome/browser/guest_view/web_view/web_view_permission_helper.h" #include "chrome/browser/guest_view/web_view/web_view_renderer_state.h" +#include "extensions/browser/guest_view/guest_view_base.h" #include "extensions/browser/guest_view/guest_view_constants.h" +#include "extensions/browser/guest_view/guest_view_manager.h" #include "extensions/common/manifest_handlers/background_info.h" #endif @@ -741,7 +741,7 @@ void ChromeContentBrowserClient::GetStoragePartitionConfigForSite( bool success = false; #if defined(ENABLE_EXTENSIONS) - success = WebViewGuest::GetGuestPartitionConfigForSite( + success = extensions::WebViewGuest::GetGuestPartitionConfigForSite( site, partition_domain, partition_name, in_memory); if (!success && site.SchemeIs(extensions::kExtensionScheme)) { @@ -1576,7 +1576,7 @@ void ChromeContentBrowserClient::GuestPermissionRequestHelper( process_map.insert(std::pair<int, int>(i->first, i->second)); - if (WebViewRendererState::GetInstance()->IsGuest(i->first)) + if (extensions::WebViewRendererState::GetInstance()->IsGuest(i->first)) has_web_view_guest = true; } if (!has_web_view_guest) { @@ -1608,9 +1608,9 @@ void ChromeContentBrowserClient::RequestFileSystemPermissionOnUIThread( bool allowed_by_default, const base::Callback<void(bool)>& callback) { DCHECK(BrowserThread:: CurrentlyOn(BrowserThread::UI)); - WebViewPermissionHelper* web_view_permission_helper = - WebViewPermissionHelper::FromFrameID(render_process_id, - render_frame_id); + extensions::WebViewPermissionHelper* web_view_permission_helper = + extensions::WebViewPermissionHelper::FromFrameID( + render_process_id, render_frame_id); web_view_permission_helper->RequestFileSystemPermission(url, allowed_by_default, callback); @@ -2035,7 +2035,8 @@ bool ChromeContentBrowserClient::CanCreateWindow( } #if defined(ENABLE_EXTENSIONS) - if (WebViewRendererState::GetInstance()->IsGuest(render_process_id)) + if (extensions::WebViewRendererState::GetInstance()->IsGuest( + render_process_id)) return true; #endif diff --git a/chrome/browser/devtools/devtools_target_impl.cc b/chrome/browser/devtools/devtools_target_impl.cc index 7f2bfb0..04c7ab6 100644 --- a/chrome/browser/devtools/devtools_target_impl.cc +++ b/chrome/browser/devtools/devtools_target_impl.cc @@ -8,7 +8,6 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/devtools/devtools_window.h" #include "chrome/browser/extensions/extension_tab_util.h" -#include "chrome/browser/guest_view/guest_view_base.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" @@ -22,6 +21,7 @@ #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/guest_view/guest_view_base.h" #include "extensions/browser/process_manager.h" #include "extensions/common/constants.h" @@ -85,7 +85,8 @@ WebContentsTarget::WebContentsTarget(WebContents* web_contents, bool is_tab) set_favicon_url(entry->GetFavicon().url); set_last_activity_time(web_contents->GetLastActiveTime()); - GuestViewBase* guest = GuestViewBase::FromWebContents(web_contents); + extensions::GuestViewBase* guest = + extensions::GuestViewBase::FromWebContents(web_contents); WebContents* guest_contents = guest ? guest->embedder_web_contents() : NULL; if (guest_contents) { set_type(kTargetTypeWebView); diff --git a/chrome/browser/extensions/api/guest_view/guest_view_internal_api.cc b/chrome/browser/extensions/api/guest_view/guest_view_internal_api.cc index cc2ac3b..f16f353 100644 --- a/chrome/browser/extensions/api/guest_view/guest_view_internal_api.cc +++ b/chrome/browser/extensions/api/guest_view/guest_view_internal_api.cc @@ -4,12 +4,12 @@ #include "chrome/browser/extensions/api/guest_view/guest_view_internal_api.h" -#include "chrome/browser/guest_view/guest_view_base.h" -#include "chrome/browser/guest_view/guest_view_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/extensions/api/guest_view_internal.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" +#include "extensions/browser/guest_view/guest_view_base.h" +#include "extensions/browser/guest_view/guest_view_manager.h" #include "extensions/common/permissions/permissions_data.h" namespace guest_view_internal = extensions::api::guest_view_internal; diff --git a/chrome/browser/extensions/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc index 67f69d4..ac2a9cf 100644 --- a/chrome/browser/extensions/api/identity/identity_apitest.cc +++ b/chrome/browser/extensions/api/identity/identity_apitest.cc @@ -18,7 +18,6 @@ #include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/extensions/extension_function_test_utils.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/guest_view/guest_view_base.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/account_reconcilor_factory.h" #include "chrome/browser/signin/fake_account_reconcilor.h" @@ -40,6 +39,7 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/test/test_utils.h" +#include "extensions/browser/guest_view/guest_view_base.h" #include "extensions/common/id_util.h" #include "google_apis/gaia/google_service_auth_error.h" #include "google_apis/gaia/oauth2_mint_token_flow.h" diff --git a/chrome/browser/extensions/api/identity/web_auth_flow.cc b/chrome/browser/extensions/api/identity/web_auth_flow.cc index fcba514..8c5200d 100644 --- a/chrome/browser/extensions/api/identity/web_auth_flow.cc +++ b/chrome/browser/extensions/api/identity/web_auth_flow.cc @@ -13,7 +13,6 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/extensions/component_loader.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/guest_view/guest_view_base.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/extensions/api/identity_private.h" #include "chrome/common/extensions/extension_constants.h" @@ -29,6 +28,7 @@ #include "crypto/random.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/guest_view/guest_view_base.h" #include "grit/browser_resources.h" #include "url/gurl.h" diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc index 80690a0..5d2ff09 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api.cc @@ -185,12 +185,13 @@ void ExtractRequestRoutingInfo(net::URLRequest* request, // a <webview> guest process or not. If it is from a <webview> guest process, // then |web_view_info| is returned with information about the instance ID // that uniquely identifies the <webview> and its embedder. -bool GetWebViewInfo(net::URLRequest* request, - WebViewRendererState::WebViewInfo* web_view_info) { +bool GetWebViewInfo( + net::URLRequest* request, + extensions::WebViewRendererState::WebViewInfo* web_view_info) { int render_process_host_id = -1; int routing_id = -1; ExtractRequestRoutingInfo(request, &render_process_host_id, &routing_id); - return WebViewRendererState::GetInstance()-> + return extensions::WebViewRendererState::GetInstance()-> GetInfo(render_process_host_id, routing_id, web_view_info); } @@ -406,7 +407,7 @@ void SendOnMessageEventOnUI( void* profile_id, const std::string& extension_id, bool is_web_view_guest, - const WebViewRendererState::WebViewInfo& web_view_info, + const extensions::WebViewRendererState::WebViewInfo& web_view_info, scoped_ptr<base::DictionaryValue> event_argument) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -1471,8 +1472,8 @@ void ExtensionWebRequestEventRouter::GetMatchingListenersImpl( std::vector<const ExtensionWebRequestEventRouter::EventListener*>* matching_listeners) { std::string web_request_event_name(event_name); - WebViewRendererState::WebViewInfo web_view_info; - bool is_web_view_guest = WebViewRendererState::GetInstance()-> + extensions::WebViewRendererState::WebViewInfo web_view_info; + bool is_web_view_guest = extensions::WebViewRendererState::GetInstance()-> GetInfo(render_process_host_id, routing_id, &web_view_info); if (is_web_view_guest) { web_request_event_name.replace( @@ -1848,7 +1849,7 @@ void ExtensionWebRequestEventRouter::SendMessages( message != messages.end(); ++message) { scoped_ptr<base::DictionaryValue> argument(new base::DictionaryValue); ExtractRequestInfo(blocked_request.request, argument.get()); - WebViewRendererState::WebViewInfo web_view_info; + extensions::WebViewRendererState::WebViewInfo web_view_info; bool is_web_view_guest = GetWebViewInfo(blocked_request.request, &web_view_info); argument->SetString(keys::kMessageKey, *message); @@ -1977,7 +1978,7 @@ bool ExtensionWebRequestEventRouter::ProcessDeclarativeRules( net::URLRequest* request, extensions::RequestStage request_stage, const net::HttpResponseHeaders* original_response_headers) { - WebViewRendererState::WebViewInfo web_view_info; + extensions::WebViewRendererState::WebViewInfo web_view_info; bool is_web_view_guest = GetWebViewInfo(request, &web_view_info); RulesRegistryService::WebViewKey webview_key( diff --git a/chrome/browser/extensions/api/web_request/web_request_permissions.cc b/chrome/browser/extensions/api/web_request/web_request_permissions.cc index c3d4718a..d343110 100644 --- a/chrome/browser/extensions/api/web_request/web_request_permissions.cc +++ b/chrome/browser/extensions/api/web_request/web_request_permissions.cc @@ -86,7 +86,7 @@ bool WebRequestPermissions::HideRequest( if (info) { int process_id = info->GetChildID(); // Never hide requests from guest processes. - if (WebViewRendererState::GetInstance()->IsGuest(process_id)) + if (extensions::WebViewRendererState::GetInstance()->IsGuest(process_id)) return false; if (extension_info_map && ( diff --git a/chrome/browser/geolocation/geolocation_permission_context_extensions.cc b/chrome/browser/geolocation/geolocation_permission_context_extensions.cc index e0496b1..04873f9 100644 --- a/chrome/browser/geolocation/geolocation_permission_context_extensions.cc +++ b/chrome/browser/geolocation/geolocation_permission_context_extensions.cc @@ -41,8 +41,8 @@ bool GeolocationPermissionContextExtensions::RequestPermission( #if defined(ENABLE_EXTENSIONS) GURL requesting_frame_origin = requesting_frame.GetOrigin(); - WebViewPermissionHelper* web_view_permission_helper = - WebViewPermissionHelper::FromWebContents(web_contents); + extensions::WebViewPermissionHelper* web_view_permission_helper = + extensions::WebViewPermissionHelper::FromWebContents(web_contents); if (web_view_permission_helper) { web_view_permission_helper->RequestGeolocationPermission( bridge_id, requesting_frame, user_gesture, callback); @@ -90,9 +90,10 @@ bool GeolocationPermissionContextExtensions::CancelPermissionRequest( content::WebContents* web_contents, int bridge_id) { #if defined(ENABLE_EXTENSIONS) - WebViewPermissionHelper* web_view_permission_helper = - web_contents ? WebViewPermissionHelper::FromWebContents(web_contents) - : NULL; + extensions::WebViewPermissionHelper* web_view_permission_helper = + web_contents ? + extensions::WebViewPermissionHelper::FromWebContents(web_contents) + : NULL; if (web_view_permission_helper) { web_view_permission_helper->CancelGeolocationPermissionRequest(bridge_id); return true; diff --git a/chrome/browser/guest_view/app_view/app_view_guest.cc b/chrome/browser/guest_view/app_view/app_view_guest.cc index 6df3c5d..f92e4ab 100644 --- a/chrome/browser/guest_view/app_view/app_view_guest.cc +++ b/chrome/browser/guest_view/app_view/app_view_guest.cc @@ -8,7 +8,6 @@ #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/guest_view/app_view/app_view_constants.h" -#include "chrome/browser/guest_view/guest_view_manager.h" #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" #include "chrome/common/chrome_switches.h" #include "components/renderer_context_menu/context_menu_delegate.h" @@ -18,6 +17,7 @@ #include "extensions/browser/event_router.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/guest_view/guest_view_manager.h" #include "extensions/browser/lazy_background_task_queue.h" #include "extensions/browser/view_type_utils.h" #include "extensions/common/api/app_runtime.h" @@ -30,6 +30,8 @@ using content::RenderFrameHost; using content::WebContents; using extensions::ExtensionHost; +namespace extensions { + namespace { struct ResponseInfo { @@ -248,3 +250,4 @@ void AppViewGuest::LaunchAppAndFireEvent( browser_context(), embed_request.Pass(), extension_host->extension()); } +} // namespace extensions diff --git a/chrome/browser/guest_view/app_view/app_view_guest.h b/chrome/browser/guest_view/app_view/app_view_guest.h index 831941e..5643d21 100644 --- a/chrome/browser/guest_view/app_view/app_view_guest.h +++ b/chrome/browser/guest_view/app_view/app_view_guest.h @@ -6,13 +6,12 @@ #define CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ #include "base/id_map.h" -#include "chrome/browser/guest_view/guest_view.h" #include "extensions/browser/extension_function_dispatcher.h" +#include "extensions/browser/guest_view/guest_view.h" namespace extensions { class Extension; class ExtensionHost; -}; // An AppViewGuest provides the browser-side implementation of <appview> API. // AppViewGuest is created on attachment. That is, when a guest WebContents is @@ -83,4 +82,6 @@ class AppViewGuest : public GuestView<AppViewGuest>, DISALLOW_COPY_AND_ASSIGN(AppViewGuest); }; +} // namespace extensions + #endif // CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_ diff --git a/chrome/browser/guest_view/extension_options/extension_options_guest.cc b/chrome/browser/guest_view/extension_options/extension_options_guest.cc index f41cc80..6d89f6f 100644 --- a/chrome/browser/guest_view/extension_options/extension_options_guest.cc +++ b/chrome/browser/guest_view/extension_options/extension_options_guest.cc @@ -41,7 +41,7 @@ const char* ExtensionOptionsGuest::GetAPINamespace() { } // static -GuestViewBase* ExtensionOptionsGuest::Create( +extensions::GuestViewBase* ExtensionOptionsGuest::Create( content::BrowserContext* browser_context, int guest_instance_id) { if (!extensions::FeatureSwitch::embedded_extension_options()->IsEnabled()) { @@ -114,7 +114,7 @@ void ExtensionOptionsGuest::DidInitialize() { void ExtensionOptionsGuest::DidStopLoading() { scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); - DispatchEventToEmbedder(new GuestViewBase::Event( + DispatchEventToEmbedder(new extensions::GuestViewBase::Event( extensions::api::extension_options_internal::OnLoad::kEventName, args.Pass())); } @@ -144,7 +144,7 @@ void ExtensionOptionsGuest::GuestSizeChangedDueToAutoSize( scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); args->SetInteger(extensionoptions::kWidth, new_size.width()); args->SetInteger(extensionoptions::kHeight, new_size.height()); - DispatchEventToEmbedder(new GuestViewBase::Event( + DispatchEventToEmbedder(new extensions::GuestViewBase::Event( extension_options_internal::OnSizeChanged::kEventName, args.Pass())); } diff --git a/chrome/browser/guest_view/extension_options/extension_options_guest.h b/chrome/browser/guest_view/extension_options/extension_options_guest.h index 65e33fb..78ed020 100644 --- a/chrome/browser/guest_view/extension_options/extension_options_guest.h +++ b/chrome/browser/guest_view/extension_options/extension_options_guest.h @@ -6,8 +6,8 @@ #define CHROME_BROWSER_GUEST_VIEW_EXTENSION_OPTIONS_EXTENSION_OPTIONS_GUEST_H_ #include "base/macros.h" -#include "chrome/browser/guest_view/guest_view.h" #include "extensions/browser/extension_function_dispatcher.h" +#include "extensions/browser/guest_view/guest_view.h" #include "url/gurl.h" namespace content { @@ -15,12 +15,12 @@ class BrowserContext; } class ExtensionOptionsGuest - : public GuestView<ExtensionOptionsGuest>, + : public extensions::GuestView<ExtensionOptionsGuest>, public extensions::ExtensionFunctionDispatcher::Delegate { public: static const char Type[]; - static GuestViewBase* Create(content::BrowserContext* browser_context, - int guest_instance_id); + static extensions::GuestViewBase* Create( + content::BrowserContext* browser_context, int guest_instance_id); // GuestViewBase implementation. virtual const char* GetAPINamespace() OVERRIDE; diff --git a/chrome/browser/guest_view/web_view/javascript_dialog_helper.cc b/chrome/browser/guest_view/web_view/javascript_dialog_helper.cc index c6dc2f6..6fe90b1 100644 --- a/chrome/browser/guest_view/web_view/javascript_dialog_helper.cc +++ b/chrome/browser/guest_view/web_view/javascript_dialog_helper.cc @@ -12,6 +12,8 @@ #include "chrome/browser/guest_view/web_view/web_view_permission_types.h" #include "extensions/browser/guest_view/guest_view_constants.h" +namespace extensions { + namespace { std::string JavaScriptMessageTypeToString( @@ -100,3 +102,5 @@ void JavaScriptDialogHelper::OnPermissionResponse( callback.Run(allow && web_view_guest_->attached(), base::UTF8ToUTF16(user_input)); } + +} // namespace extensions diff --git a/chrome/browser/guest_view/web_view/javascript_dialog_helper.h b/chrome/browser/guest_view/web_view/javascript_dialog_helper.h index 7f37002..654b0a2 100644 --- a/chrome/browser/guest_view/web_view/javascript_dialog_helper.h +++ b/chrome/browser/guest_view/web_view/javascript_dialog_helper.h @@ -7,6 +7,8 @@ #include "content/public/browser/javascript_dialog_manager.h" +namespace extensions { + class WebViewGuest; class JavaScriptDialogHelper : public content::JavaScriptDialogManager { @@ -50,4 +52,6 @@ class JavaScriptDialogHelper : public content::JavaScriptDialogManager { DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogHelper); }; +} // namespace extensions + #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_JAVASCRIPT_DIALOG_HELPER_H_ diff --git a/chrome/browser/guest_view/web_view/web_view_find_helper.cc b/chrome/browser/guest_view/web_view/web_view_find_helper.cc index 229565b4..b2a5e99 100644 --- a/chrome/browser/guest_view/web_view/web_view_find_helper.cc +++ b/chrome/browser/guest_view/web_view/web_view_find_helper.cc @@ -9,6 +9,8 @@ #include "chrome/browser/extensions/api/web_view/web_view_internal_api.h" #include "chrome/browser/guest_view/web_view/web_view_constants.h" +namespace extensions { + WebViewFindHelper::WebViewFindHelper(WebViewGuest* webview_guest) : webview_guest_(webview_guest), current_find_request_id_(0) { } @@ -276,3 +278,5 @@ void WebViewFindHelper::FindInfo::SendResponse(bool canceled) { find_function_->SetResult(results.DeepCopy()); find_function_->SendResponse(true); } + +} // namespace extensions diff --git a/chrome/browser/guest_view/web_view/web_view_find_helper.h b/chrome/browser/guest_view/web_view/web_view_find_helper.h index 9d4d74c..eac5ab8 100644 --- a/chrome/browser/guest_view/web_view/web_view_find_helper.h +++ b/chrome/browser/guest_view/web_view/web_view_find_helper.h @@ -16,7 +16,6 @@ namespace extensions { class WebViewInternalFindFunction; -} // namespace extensions class WebViewGuest; // Helper class for find requests and replies for the web_view_internal find @@ -186,4 +185,6 @@ class WebViewFindHelper { DISALLOW_COPY_AND_ASSIGN(WebViewFindHelper); }; +} // namespace extensions + #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_FIND_HELPER_H_ diff --git a/chrome/browser/guest_view/web_view/web_view_guest.cc b/chrome/browser/guest_view/web_view/web_view_guest.cc index 181749e..87cffee 100644 --- a/chrome/browser/guest_view/web_view/web_view_guest.cc +++ b/chrome/browser/guest_view/web_view/web_view_guest.cc @@ -14,7 +14,6 @@ #include "chrome/browser/extensions/menu_manager.h" #include "chrome/browser/extensions/script_executor.h" #include "chrome/browser/favicon/favicon_tab_helper.h" -#include "chrome/browser/guest_view/guest_view_manager.h" #include "chrome/browser/guest_view/web_view/web_view_constants.h" #include "chrome/browser/guest_view/web_view/web_view_permission_helper.h" #include "chrome/browser/guest_view/web_view/web_view_permission_types.h" @@ -49,6 +48,7 @@ #include "content/public/common/url_constants.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/guest_view/guest_view_constants.h" +#include "extensions/browser/guest_view/guest_view_manager.h" #include "extensions/common/constants.h" #include "ipc/ipc_message_macros.h" #include "net/base/escape.h" @@ -74,6 +74,8 @@ using content::RenderFrameHost; using content::ResourceType; using content::WebContents; +namespace extensions { + namespace { std::string WindowOpenDispositionToString( @@ -1259,3 +1261,5 @@ void WebViewGuest::OnWebViewNewWindowResponse( if (!allow) guest->Destroy(); } + +} // namespace extensions diff --git a/chrome/browser/guest_view/web_view/web_view_guest.h b/chrome/browser/guest_view/web_view/web_view_guest.h index 39e3c72..1ddda0c 100644 --- a/chrome/browser/guest_view/web_view/web_view_guest.h +++ b/chrome/browser/guest_view/web_view/web_view_guest.h @@ -9,7 +9,6 @@ #include "base/observer_list.h" #include "chrome/browser/extensions/tab_helper.h" -#include "chrome/browser/guest_view/guest_view.h" #include "chrome/browser/guest_view/web_view/javascript_dialog_helper.h" #include "chrome/browser/guest_view/web_view/web_view_find_helper.h" #include "chrome/browser/guest_view/web_view/web_view_permission_helper.h" @@ -17,6 +16,7 @@ #include "chrome/common/extensions/api/web_view_internal.h" #include "content/public/browser/javascript_dialog_manager.h" #include "content/public/browser/notification_registrar.h" +#include "extensions/browser/guest_view/guest_view.h" #include "third_party/WebKit/public/web/WebFindOptions.h" #if defined(OS_CHROMEOS) @@ -27,15 +27,14 @@ namespace webview_api = extensions::api::web_view_internal; class RenderViewContextMenu; -namespace extensions { -class ScriptExecutor; -class WebViewInternalFindFunction; -} // namespace extensions - namespace ui { class SimpleMenuModel; } // namespace ui +namespace extensions { +class ScriptExecutor; +class WebViewInternalFindFunction; + // A WebViewGuest provides the browser-side implementation of the <webview> API // and manages the dispatch of <webview> extension events. WebViewGuest is // created on attachment. That is, when a guest WebContents is associated with @@ -399,4 +398,6 @@ class WebViewGuest : public GuestView<WebViewGuest>, DISALLOW_COPY_AND_ASSIGN(WebViewGuest); }; +} // namespace extensions + #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ diff --git a/chrome/browser/guest_view/web_view/web_view_permission_helper.cc b/chrome/browser/guest_view/web_view/web_view_permission_helper.cc index c5b0aaa..14422cf 100644 --- a/chrome/browser/guest_view/web_view/web_view_permission_helper.cc +++ b/chrome/browser/guest_view/web_view/web_view_permission_helper.cc @@ -20,6 +20,8 @@ using content::BrowserPluginGuestDelegate; using content::RenderViewHost; +namespace extensions { + namespace { static std::string PermissionTypeToString(WebViewPermissionType type) { switch (type) { @@ -597,3 +599,5 @@ WebViewPermissionHelper::PermissionResponseInfo::PermissionResponseInfo( WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { } + +} // namespace extensions diff --git a/chrome/browser/guest_view/web_view/web_view_permission_helper.h b/chrome/browser/guest_view/web_view/web_view_permission_helper.h index 6dcba88..76ed36e 100644 --- a/chrome/browser/guest_view/web_view/web_view_permission_helper.h +++ b/chrome/browser/guest_view/web_view/web_view_permission_helper.h @@ -15,6 +15,8 @@ using base::UserMetricsAction; +namespace extensions { + class WebViewGuest; // WebViewPermissionHelper manages <webview> permission requests. This helper @@ -211,4 +213,6 @@ class WebViewPermissionHelper DISALLOW_COPY_AND_ASSIGN(WebViewPermissionHelper); }; +} // namespace extensions + #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_PERMISSION_HELPER_H_ diff --git a/chrome/browser/guest_view/web_view/web_view_renderer_state.cc b/chrome/browser/guest_view/web_view/web_view_renderer_state.cc index 6ff54c8..89c0f6e 100644 --- a/chrome/browser/guest_view/web_view/web_view_renderer_state.cc +++ b/chrome/browser/guest_view/web_view/web_view_renderer_state.cc @@ -7,6 +7,8 @@ using content::BrowserThread; +namespace extensions { + // static WebViewRendererState* WebViewRendererState::GetInstance() { return Singleton<WebViewRendererState>::get(); @@ -79,3 +81,5 @@ bool WebViewRendererState::GetPartitionID(int guest_process_id, } return false; } + +} // namespace extensions diff --git a/chrome/browser/guest_view/web_view/web_view_renderer_state.h b/chrome/browser/guest_view/web_view/web_view_renderer_state.h index a0325e0..ab785e7 100644 --- a/chrome/browser/guest_view/web_view/web_view_renderer_state.h +++ b/chrome/browser/guest_view/web_view/web_view_renderer_state.h @@ -11,6 +11,8 @@ #include "base/memory/singleton.h" +namespace extensions { + class WebViewGuest; // This class keeps track of <webview> renderer state for use on the IO thread. @@ -70,4 +72,6 @@ class WebViewRendererState { DISALLOW_COPY_AND_ASSIGN(WebViewRendererState); }; +} // namespace extensions + #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_RENDERER_STATE_H_ diff --git a/chrome/browser/plugins/plugin_info_message_filter.cc b/chrome/browser/plugins/plugin_info_message_filter.cc index b091d45..2eade2a 100644 --- a/chrome/browser/plugins/plugin_info_message_filter.cc +++ b/chrome/browser/plugins/plugin_info_message_filter.cc @@ -247,7 +247,8 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus( CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); // NPAPI plugins are not supported inside <webview> guests. #if defined(ENABLE_EXTENSIONS) - if (WebViewRendererState::GetInstance()->IsGuest(render_process_id_)) { + if (extensions::WebViewRendererState::GetInstance()->IsGuest( + render_process_id_)) { status->value = ChromeViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported; return; @@ -325,7 +326,8 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus( // and update the status as appropriate depending on the response from the // embedder. #if defined(ENABLE_EXTENSIONS) - if (WebViewRendererState::GetInstance()->IsGuest(render_process_id_)) + if (extensions::WebViewRendererState::GetInstance()->IsGuest( + render_process_id_)) status->value = ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized; #endif diff --git a/chrome/browser/prerender/prerender_link_manager.cc b/chrome/browser/prerender/prerender_link_manager.cc index 652eaae..85c721d 100644 --- a/chrome/browser/prerender/prerender_link_manager.cc +++ b/chrome/browser/prerender/prerender_link_manager.cc @@ -28,7 +28,7 @@ #include "url/gurl.h" #if defined(ENABLE_EXTENSIONS) -#include "chrome/browser/guest_view/guest_view_base.h" +#include "extensions/browser/guest_view/guest_view_base.h" #endif using base::TimeDelta; @@ -177,7 +177,7 @@ void PrerenderLinkManager::OnAddPrerender(int launcher_child_id, rvh ? content::WebContents::FromRenderViewHost(rvh) : NULL; // Guests inside <webview> do not support cross-process navigation and so we // do not allow guests to prerender content. - if (GuestViewBase::IsGuest(web_contents)) + if (extensions::GuestViewBase::IsGuest(web_contents)) return; #endif diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc index 1d05bc2..61bb7a6 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.cc +++ b/chrome/browser/profiles/off_the_record_profile_impl.cc @@ -71,8 +71,8 @@ #if defined(ENABLE_EXTENSIONS) #include "chrome/browser/extensions/api/web_request/web_request_api.h" -#include "chrome/browser/guest_view/guest_view_manager.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/guest_view/guest_view_manager.h" #include "extensions/common/extension.h" #endif @@ -364,7 +364,7 @@ HostContentSettingsMap* OffTheRecordProfileImpl::GetHostContentSettingsMap() { content::BrowserPluginGuestManager* OffTheRecordProfileImpl::GetGuestManager() { #if defined(ENABLE_EXTENSIONS) - return GuestViewManager::FromBrowserContext(this); + return extensions::GuestViewManager::FromBrowserContext(this); #else return NULL; #endif diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index bd6fa63..557912c 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -138,12 +138,12 @@ #if defined(ENABLE_EXTENSIONS) #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_special_storage_policy.h" -#include "chrome/browser/guest_view/guest_view_manager.h" #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" #include "extensions/browser/extension_pref_store.h" #include "extensions/browser/extension_pref_value_map.h" #include "extensions/browser/extension_pref_value_map_factory.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/guest_view/guest_view_manager.h" #endif #if defined(ENABLE_MANAGED_USERS) @@ -1089,7 +1089,7 @@ HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { content::BrowserPluginGuestManager* ProfileImpl::GetGuestManager() { #if defined(ENABLE_EXTENSIONS) - return GuestViewManager::FromBrowserContext(this); + return extensions::GuestViewManager::FromBrowserContext(this); #else return NULL; #endif diff --git a/chrome/browser/renderer_context_menu/context_menu_content_type_factory.cc b/chrome/browser/renderer_context_menu/context_menu_content_type_factory.cc index c56029e..b94f3da 100644 --- a/chrome/browser/renderer_context_menu/context_menu_content_type_factory.cc +++ b/chrome/browser/renderer_context_menu/context_menu_content_type_factory.cc @@ -58,7 +58,7 @@ ContextMenuContentType* ContextMenuContentTypeFactory::CreateInternal( content::WebContents* web_contents, const content::ContextMenuParams& params) { #if defined(ENABLE_EXTENSIONS) - if (WebViewGuest::FromWebContents(web_contents)) + if (extensions::WebViewGuest::FromWebContents(web_contents)) return new ContextMenuContentTypeWebView(web_contents, params); if (chrome::IsRunningInForcedAppMode()) diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc index c0ef40b..073e2a5 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc @@ -461,7 +461,8 @@ void RenderViewContextMenu::AppendCurrentExtensionItems() { // Only add extension items from this extension. int index = 0; const MenuItem::ExtensionKey key( - extension->id(), WebViewGuest::GetViewInstanceId(source_web_contents_)); + extension->id(), + extensions::WebViewGuest::GetViewInstanceId(source_web_contents_)); extension_items_.AppendExtensionItems( key, PrintableSelectionText(), &index); } diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.cc b/chrome/browser/renderer_host/chrome_render_message_filter.cc index dfb7b87..ef49c8e 100644 --- a/chrome/browser/renderer_host/chrome_render_message_filter.cc +++ b/chrome/browser/renderer_host/chrome_render_message_filter.cc @@ -227,10 +227,11 @@ void ChromeRenderMessageFilter::FileSystemAccessedSyncOnUIThread( bool blocked_by_policy, IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - WebViewPermissionHelper* web_view_permission_helper = - WebViewPermissionHelper::FromFrameID(render_process_id, render_frame_id); + extensions::WebViewPermissionHelper* web_view_permission_helper = + extensions::WebViewPermissionHelper::FromFrameID( + render_process_id, render_frame_id); // Between the time the permission request is made and the time it is handled - // by the UI thread, the WebViewPermissionHelper might be gone. + // by the UI thread, the extensions::WebViewPermissionHelper might be gone. if (!web_view_permission_helper) return; web_view_permission_helper->FileSystemAccessedSync( @@ -275,8 +276,8 @@ void ChromeRenderMessageFilter::OnRequestFileSystemAccess( cookie_settings_->IsSettingCookieAllowed(origin_url, top_origin_url); #if defined(ENABLE_EXTENSIONS) - bool is_web_view_guest = - WebViewRendererState::GetInstance()->IsGuest(render_process_id_); + bool is_web_view_guest = extensions::WebViewRendererState::GetInstance() + ->IsGuest(render_process_id_); if (is_web_view_guest) { // Record access to file system for potential display in UI. BrowserThread::PostTask( @@ -311,10 +312,11 @@ void ChromeRenderMessageFilter::FileSystemAccessedOnUIThread( bool allowed, base::Callback<void(bool)> callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - WebViewPermissionHelper* web_view_permission_helper = - WebViewPermissionHelper::FromFrameID(render_process_id, render_frame_id); + extensions::WebViewPermissionHelper* web_view_permission_helper = + extensions::WebViewPermissionHelper::FromFrameID( + render_process_id, render_frame_id); // Between the time the permission request is made and the time it is handled - // by the UI thread, the WebViewPermissionHelper might be gone. + // by the UI thread, the extensions::WebViewPermissionHelper might be gone. if (!web_view_permission_helper) return; web_view_permission_helper->RequestFileSystemPermission( diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc index 4d4db5b..641ea18 100644 --- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc +++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc @@ -465,7 +465,7 @@ bool ChromeResourceDispatcherHostDelegate::HandleExternalProtocol( #else #if defined(ENABLE_EXTENSIONS) - if (WebViewRendererState::GetInstance()->IsGuest(child_id)) + if (extensions::WebViewRendererState::GetInstance()->IsGuest(child_id)) return false; #endif // defined(ENABLE_EXTENSIONS) diff --git a/chrome/browser/task_manager/extension_information.cc b/chrome/browser/task_manager/extension_information.cc index b657adf..10b0139 100644 --- a/chrome/browser/task_manager/extension_information.cc +++ b/chrome/browser/task_manager/extension_information.cc @@ -7,7 +7,6 @@ #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/guest_view/guest_view_base.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/task_manager/renderer_resource.h" @@ -17,6 +16,7 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/guest_view/guest_view_base.h" #include "extensions/browser/process_manager.h" #include "extensions/browser/view_type_utils.h" #include "extensions/common/extension.h" @@ -148,7 +148,7 @@ void ExtensionInformation::GetAll(const NewWebContentsCallback& callback) { bool ExtensionInformation::CheckOwnership(WebContents* web_contents) { // Don't add WebContents that belong to a guest (those are handled by // GuestInformation). Otherwise they will be added twice. - if (GuestViewBase::IsGuest(web_contents)) + if (extensions::GuestViewBase::IsGuest(web_contents)) return false; // Extension WebContents tracked by this class will always host extension diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm index 8fcdeeb..ab7989b 100644 --- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm +++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm @@ -28,7 +28,8 @@ ConstrainedWindowMac::ConstrainedWindowMac( sheet_([sheet retain]), shown_(false) { DCHECK(web_contents); - WebViewGuest* web_view_guest = WebViewGuest::FromWebContents(web_contents); + extensions::WebViewGuest* web_view_guest = + extensions::WebViewGuest::FromWebContents(web_contents); // For embedded WebContents, use the embedder's WebContents for constrained // window. web_contents_ = web_view_guest && web_view_guest->embedder_web_contents() ? diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc index 86f1ec7..c95f31b 100644 --- a/chrome/browser/ui/views/constrained_window_views.cc +++ b/chrome/browser/ui/views/constrained_window_views.cc @@ -123,8 +123,8 @@ void UpdateBrowserModalDialogPosition(views::Widget* widget, views::Widget* ShowWebModalDialogViews( views::WidgetDelegate* dialog, content::WebContents* initiator_web_contents) { - WebViewGuest* web_view_guest = WebViewGuest::FromWebContents( - initiator_web_contents); + extensions::WebViewGuest* web_view_guest = + extensions::WebViewGuest::FromWebContents(initiator_web_contents); // For embedded WebContents, use the embedder's WebContents for constrained // window. content::WebContents* web_contents = diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index e94ebd7..ffd2eaf 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1509,12 +1509,6 @@ 'browser/guest_view/extension_options/extension_options_constants.h', 'browser/guest_view/extension_options/extension_options_guest.cc', 'browser/guest_view/extension_options/extension_options_guest.h', - 'browser/guest_view/guest_view_base.cc', - 'browser/guest_view/guest_view_base.h', - 'browser/guest_view/guest_view_manager_factory.h', - 'browser/guest_view/guest_view_manager.cc', - 'browser/guest_view/guest_view_manager.h', - 'browser/guest_view/guest_view.h', 'browser/guest_view/web_view/context_menu_content_type_web_view.cc', 'browser/guest_view/web_view/context_menu_content_type_web_view.h', 'browser/guest_view/web_view/javascript_dialog_helper.cc', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 364ac87..05671ee 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -998,7 +998,6 @@ 'browser/google/google_update_settings_unittest.cc', 'browser/google/google_url_tracker_unittest.cc', 'browser/google/google_util_unittest.cc', - 'browser/guest_view/guest_view_manager_unittest.cc', 'browser/history/android/android_cache_database_unittest.cc', 'browser/history/android/android_history_provider_service_unittest.cc', 'browser/history/android/android_history_types_unittest.cc', @@ -2117,7 +2116,6 @@ 'browser/extensions/user_script_listener_unittest.cc', 'browser/extensions/webstore_inline_installer_unittest.cc', 'browser/extensions/webstore_installer_unittest.cc', - 'browser/guest_view/guest_view_manager_unittest.cc', 'browser/search/hotword_service_unittest.cc', 'browser/web_applications/web_app_unittest.cc', 'common/extensions/sync_type_unittest.cc', diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index 72f1e80..7aede51 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -84,8 +84,8 @@ #include "chrome/browser/extensions/extension_special_storage_policy.h" #include "chrome/browser/extensions/extension_system_factory.h" #include "chrome/browser/extensions/test_extension_system.h" -#include "chrome/browser/guest_view/guest_view_manager.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/guest_view/guest_view_manager.h" #endif #if defined(OS_ANDROID) @@ -820,7 +820,7 @@ HostContentSettingsMap* TestingProfile::GetHostContentSettingsMap() { content::BrowserPluginGuestManager* TestingProfile::GetGuestManager() { #if defined(ENABLE_EXTENSIONS) - return GuestViewManager::FromBrowserContext(this); + return extensions::GuestViewManager::FromBrowserContext(this); #else return NULL; #endif diff --git a/extensions/browser/DEPS b/extensions/browser/DEPS index 9b4dd6f..08dfbdf 100644 --- a/extensions/browser/DEPS +++ b/extensions/browser/DEPS @@ -8,5 +8,6 @@ include_rules = [ "+sync", "+third_party/leveldatabase", "+third_party/skia/include", + "+third_party/WebKit/public/web/WebInputEvent.h", "+webkit/browser/fileapi", ] diff --git a/chrome/browser/guest_view/guest_view.h b/extensions/browser/guest_view/guest_view.h index b443500..02355ba 100644 --- a/chrome/browser/guest_view/guest_view.h +++ b/extensions/browser/guest_view/guest_view.h @@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ -#define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ +#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ +#define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ #include "base/bind.h" -#include "chrome/browser/guest_view/guest_view_base.h" #include "content/public/browser/render_frame_host.h" +#include "extensions/browser/guest_view/guest_view_base.h" + +namespace extensions { // A GuestView is the templated base class for out-of-process frames in the // chrome layer. GuestView is templated on its derived type to allow for type- @@ -69,4 +71,6 @@ class GuestView : public GuestViewBase { DISALLOW_COPY_AND_ASSIGN(GuestView); }; -#endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ +} // namespace extensions + +#endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_H_ diff --git a/chrome/browser/guest_view/guest_view_base.cc b/extensions/browser/guest_view/guest_view_base.cc index ddc4a0b..60e1b3c 100644 --- a/chrome/browser/guest_view/guest_view_base.cc +++ b/extensions/browser/guest_view/guest_view_base.cc @@ -2,11 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/guest_view/guest_view_base.h" +#include "extensions/browser/guest_view/guest_view_base.h" #include "base/lazy_instance.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/guest_view/guest_view_manager.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" @@ -16,6 +15,7 @@ #include "extensions/browser/event_router.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/guest_view/guest_view_constants.h" +#include "extensions/browser/guest_view/guest_view_manager.h" #include "extensions/browser/process_map.h" #include "extensions/common/features/feature.h" #include "extensions/common/features/feature_provider.h" @@ -23,6 +23,8 @@ using content::WebContents; +namespace extensions { + namespace { typedef std::map<std::string, GuestViewBase::GuestCreationCallback> @@ -448,3 +450,5 @@ void GuestViewBase::CompleteInit(const std::string& embedder_extension_id, void GuestViewBase::RegisterGuestViewTypes() { extensions::ExtensionsAPIClient::Get()->RegisterGuestViewTypes(); } + +} // namespace extensions diff --git a/chrome/browser/guest_view/guest_view_base.h b/extensions/browser/guest_view/guest_view_base.h index cbcf9cf..2360ee0 100644 --- a/chrome/browser/guest_view/guest_view_base.h +++ b/extensions/browser/guest_view/guest_view_base.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ -#define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ +#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ +#define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ #include <queue> @@ -17,6 +17,8 @@ struct RendererContentSettingRules; +namespace extensions { + // A GuestViewBase is the base class browser-side API implementation for a // <*view> tag. GuestViewBase maintains an association between a guest // WebContents and an embedder WebContents. It receives events issued from @@ -328,4 +330,6 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate, DISALLOW_COPY_AND_ASSIGN(GuestViewBase); }; -#endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ +} // namespace extensions + +#endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ diff --git a/chrome/browser/guest_view/guest_view_manager.cc b/extensions/browser/guest_view/guest_view_manager.cc index e9f2044..3a2412e 100644 --- a/chrome/browser/guest_view/guest_view_manager.cc +++ b/extensions/browser/guest_view/guest_view_manager.cc @@ -2,11 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/guest_view/guest_view_manager.h" +#include "extensions/browser/guest_view/guest_view_manager.h" #include "base/strings/stringprintf.h" -#include "chrome/browser/guest_view/guest_view_base.h" -#include "chrome/browser/guest_view/guest_view_manager_factory.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/user_metrics.h" @@ -14,7 +12,9 @@ #include "content/public/common/result_codes.h" #include "content/public/common/url_constants.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/guest_view/guest_view_base.h" #include "extensions/browser/guest_view/guest_view_constants.h" +#include "extensions/browser/guest_view/guest_view_manager_factory.h" #include "net/base/escape.h" #include "url/gurl.h" @@ -22,6 +22,8 @@ using content::BrowserContext; using content::SiteInstance; using content::WebContents; +namespace extensions { + // static GuestViewManagerFactory* GuestViewManager::factory_ = NULL; @@ -236,3 +238,5 @@ bool GuestViewManager::CanEmbedderAccessInstanceID( return embedder_render_process_id == guest_view->embedder_render_process_id(); } + +} // namespace extensions diff --git a/chrome/browser/guest_view/guest_view_manager.h b/extensions/browser/guest_view/guest_view_manager.h index 8b32ed9c..44f4249 100644 --- a/chrome/browser/guest_view/guest_view_manager.h +++ b/extensions/browser/guest_view/guest_view_manager.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ -#define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ +#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ +#define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ #include <map> @@ -14,8 +14,6 @@ #include "content/public/browser/site_instance.h" #include "content/public/browser/web_contents.h" -class GuestViewBase; -class GuestViewManagerFactory; class GURL; namespace content { @@ -23,6 +21,10 @@ class BrowserContext; class WebContents; } // namespace content +namespace extensions{ +class GuestViewBase; +class GuestViewManagerFactory; + class GuestViewManager : public content::BrowserPluginGuestManager, public base::SupportsUserData::Data { public: @@ -120,4 +122,6 @@ class GuestViewManager : public content::BrowserPluginGuestManager, DISALLOW_COPY_AND_ASSIGN(GuestViewManager); }; -#endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ +} // namespace extensions + +#endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_ diff --git a/chrome/browser/guest_view/guest_view_manager_factory.h b/extensions/browser/guest_view/guest_view_manager_factory.h index dbd6cb8..1d9a660 100644 --- a/chrome/browser/guest_view/guest_view_manager_factory.h +++ b/extensions/browser/guest_view/guest_view_manager_factory.h @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_FACTORY_H_ -#define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_FACTORY_H_ +#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_FACTORY_H_ +#define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_FACTORY_H_ + +namespace extensions { class GuestViewManagerFactory { public: @@ -14,5 +16,7 @@ class GuestViewManagerFactory { virtual ~GuestViewManagerFactory() {} }; -#endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_FACTORY_H_ +} // namespace extensions + +#endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_FACTORY_H_ diff --git a/chrome/browser/guest_view/guest_view_manager_unittest.cc b/extensions/browser/guest_view/guest_view_manager_unittest.cc index 05b53d5..aef3776 100644 --- a/chrome/browser/guest_view/guest_view_manager_unittest.cc +++ b/extensions/browser/guest_view/guest_view_manager_unittest.cc @@ -2,16 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/guest_view/guest_view_manager.h" +#include "extensions/browser/guest_view/guest_view_manager.h" -#include "chrome/test/base/testing_profile.h" +#include "content/public/browser/notification_service.h" +#include "content/public/test/test_browser_context.h" #include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/web_contents_tester.h" -#include "testing/gtest/include/gtest/gtest.h" +#include "extensions/browser/extensions_test.h" using content::WebContents; using content::WebContentsTester; +namespace extensions { + namespace guestview { // This class allows us to access some private variables in @@ -38,19 +41,21 @@ class TestGuestViewManager : public GuestViewManager { namespace { -class GuestViewManagerTest : public testing::Test { +class GuestViewManagerTest : public extensions::ExtensionsTest { public: - GuestViewManagerTest() {} + GuestViewManagerTest() : + notification_service_(content::NotificationService::Create()) {} virtual ~GuestViewManagerTest() {} scoped_ptr<WebContents> CreateWebContents() { return scoped_ptr<WebContents>( - WebContentsTester::CreateTestWebContents(&profile_, NULL)); + WebContentsTester::CreateTestWebContents(&browser_context_, NULL)); } private: + scoped_ptr<content::NotificationService> notification_service_; content::TestBrowserThreadBundle thread_bundle_; - TestingProfile profile_; + content::TestBrowserContext browser_context_; DISALLOW_COPY_AND_ASSIGN(GuestViewManagerTest); }; @@ -58,9 +63,9 @@ class GuestViewManagerTest : public testing::Test { } // namespace TEST_F(GuestViewManagerTest, AddRemove) { - TestingProfile profile; + content::TestBrowserContext browser_context; scoped_ptr<guestview::TestGuestViewManager> manager( - new guestview::TestGuestViewManager(&profile)); + new guestview::TestGuestViewManager(&browser_context)); scoped_ptr<WebContents> web_contents1(CreateWebContents()); scoped_ptr<WebContents> web_contents2(CreateWebContents()); @@ -100,3 +105,5 @@ TEST_F(GuestViewManagerTest, AddRemove) { EXPECT_EQ(0u, manager->GetRemovedInstanceIdSize()); } + +} // namespace extensions diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index 24159ae..0be51ce 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp @@ -450,8 +450,14 @@ 'browser/external_provider_interface.h', 'browser/granted_file_entry.cc', 'browser/granted_file_entry.h', + 'browser/guest_view/guest_view_base.cc', + 'browser/guest_view/guest_view_base.h', 'browser/guest_view/guest_view_constants.cc', 'browser/guest_view/guest_view_constants.h', + 'browser/guest_view/guest_view_manager_factory.h', + 'browser/guest_view/guest_view_manager.cc', + 'browser/guest_view/guest_view_manager.h', + 'browser/guest_view/guest_view.h', 'browser/image_loader.cc', 'browser/image_loader.h', 'browser/image_loader_factory.cc', @@ -844,6 +850,7 @@ 'browser/extension_registry_unittest.cc', 'browser/file_highlighter_unittest.cc', 'browser/file_reader_unittest.cc', + 'browser/guest_view/guest_view_manager_unittest.cc', 'browser/image_loader_unittest.cc', 'browser/image_util_unittest.cc', 'browser/lazy_background_task_queue_unittest.cc', |