summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/BUILD.gn1
-rw-r--r--chrome/browser/DEPS1
-rw-r--r--chrome/browser/apps/guest_view/app_view_browsertest.cc13
-rw-r--r--chrome/browser/apps/guest_view/extension_view/extension_view_browsertest.cc19
-rw-r--r--chrome/browser/apps/guest_view/web_view_browsertest.cc17
-rw-r--r--chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc22
-rw-r--r--chrome/browser/chrome_content_browser_client.cc4
-rw-r--r--chrome/browser/chromeos/login/helper.cc6
-rw-r--r--chrome/browser/chromeos/profiles/profile_helper.cc2
-rw-r--r--chrome/browser/devtools/devtools_target_impl.cc6
-rw-r--r--chrome/browser/extensions/api/identity/identity_apitest.cc3
-rw-r--r--chrome/browser/extensions/api/identity/web_auth_flow.cc3
-rw-r--r--chrome/browser/extensions/api/messaging/message_service.cc2
-rw-r--r--chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc4
-rw-r--r--chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc5
-rw-r--r--chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.cc12
-rw-r--r--chrome/browser/plugins/plugin_info_message_filter.cc2
-rw-r--r--chrome/browser/prerender/prerender_link_manager.cc4
-rw-r--r--chrome/browser/printing/print_preview_dialog_controller.cc12
-rw-r--r--chrome/browser/printing/print_view_manager_common.cc6
-rw-r--r--chrome/browser/profiles/off_the_record_profile_impl.cc4
-rw-r--r--chrome/browser/profiles/profile_impl.cc4
-rw-r--r--chrome/browser/renderer_context_menu/render_view_context_menu.cc4
-rw-r--r--chrome/browser/task_manager/extension_information.cc4
-rw-r--r--chrome/browser/task_manager/guest_information.cc10
-rw-r--r--chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm10
-rw-r--r--chrome/browser/ui/login/login_prompt.cc4
-rw-r--r--chrome/browser/ui/tab_contents/core_tab_helper.cc4
-rw-r--r--chrome/browser/ui/views/chrome_constrained_window_views_client.cc6
-rw-r--r--chrome/browser/ui/webui/signin/inline_login_ui.cc6
-rw-r--r--chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc8
-rw-r--r--chrome/chrome_browser.gypi1
-rw-r--r--chrome/chrome_tests.gypi4
-rw-r--r--chrome/test/BUILD.gn2
-rw-r--r--chrome/test/base/testing_profile.cc4
-rw-r--r--components/BUILD.gn1
-rw-r--r--components/components.gyp1
-rw-r--r--components/components_tests.gyp6
-rw-r--r--components/constrained_window/BUILD.gn1
-rw-r--r--components/constrained_window/DEPS1
-rw-r--r--components/constrained_window/constrained_window_views.cc5
-rw-r--r--components/constrained_window/constrained_window_views_client.h5
-rw-r--r--components/guest_view.gypi55
-rw-r--r--components/guest_view/BUILD.gn46
-rw-r--r--components/guest_view/OWNERS3
-rw-r--r--components/guest_view/browser/DEPS8
-rw-r--r--components/guest_view/browser/guest_view.h (renamed from extensions/browser/guest_view/guest_view.h)14
-rw-r--r--components/guest_view/browser/guest_view_base.cc (renamed from extensions/browser/guest_view/guest_view_base.cc)55
-rw-r--r--components/guest_view/browser/guest_view_base.h (renamed from extensions/browser/guest_view/guest_view_base.h)14
-rw-r--r--components/guest_view/browser/guest_view_event.cc (renamed from extensions/browser/guest_view/guest_view_event.cc)10
-rw-r--r--components/guest_view/browser/guest_view_event.h (renamed from extensions/browser/guest_view/guest_view_event.h)10
-rw-r--r--components/guest_view/browser/guest_view_manager.cc (renamed from extensions/browser/guest_view/guest_view_manager.cc)29
-rw-r--r--components/guest_view/browser/guest_view_manager.h (renamed from extensions/browser/guest_view/guest_view_manager.h)20
-rw-r--r--components/guest_view/browser/guest_view_manager_delegate.cc23
-rw-r--r--components/guest_view/browser/guest_view_manager_delegate.h (renamed from extensions/browser/guest_view/guest_view_manager_delegate.h)28
-rw-r--r--components/guest_view/browser/guest_view_manager_factory.h (renamed from extensions/browser/guest_view/guest_view_manager_factory.h)17
-rw-r--r--components/guest_view/browser/guest_view_manager_unittest.cc (renamed from extensions/browser/guest_view/guest_view_manager_unittest.cc)32
-rw-r--r--components/guest_view/browser/guest_view_message_filter.cc (renamed from extensions/browser/guest_view/guest_view_message_filter.cc)12
-rw-r--r--components/guest_view/browser/guest_view_message_filter.h (renamed from extensions/browser/guest_view/guest_view_message_filter.h)10
-rw-r--r--components/guest_view/browser/test_guest_view_manager.cc (renamed from extensions/browser/guest_view/test_guest_view_manager.cc)17
-rw-r--r--components/guest_view/browser/test_guest_view_manager.h (renamed from extensions/browser/guest_view/test_guest_view_manager.h)22
-rw-r--r--components/guest_view/common/DEPS3
-rw-r--r--components/guest_view/common/OWNERS15
-rw-r--r--components/guest_view/common/guest_view_constants.cc (renamed from extensions/common/guest_view/guest_view_constants.cc)4
-rw-r--r--components/guest_view/common/guest_view_constants.h (renamed from extensions/common/guest_view/guest_view_constants.h)10
-rw-r--r--components/guest_view/common/guest_view_message_generator.cc33
-rw-r--r--components/guest_view/common/guest_view_message_generator.h7
-rw-r--r--components/guest_view/common/guest_view_messages.h (renamed from extensions/common/guest_view/guest_view_messages.h)0
-rw-r--r--extensions/BUILD.gn1
-rw-r--r--extensions/DEPS1
-rw-r--r--extensions/browser/DEPS1
-rw-r--r--extensions/browser/api/guest_view/guest_view_internal_api.cc18
-rw-r--r--extensions/browser/guest_view/app_view/app_view_apitest.cc10
-rw-r--r--extensions/browser/guest_view/app_view/app_view_guest.cc3
-rw-r--r--extensions/browser/guest_view/app_view/app_view_guest.h4
-rw-r--r--extensions/browser/guest_view/extension_options/extension_options_guest.cc8
-rw-r--r--extensions/browser/guest_view/extension_options/extension_options_guest.h6
-rw-r--r--extensions/browser/guest_view/extension_view/extension_view_guest.cc8
-rw-r--r--extensions/browser/guest_view/extension_view/extension_view_guest.h8
-rw-r--r--extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc14
-rw-r--r--extensions/browser/guest_view/extensions_guest_view_manager_delegate.h15
-rw-r--r--extensions/browser/guest_view/extensions_guest_view_message_filter.cc17
-rw-r--r--extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc3
-rw-r--r--extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h7
-rw-r--r--extensions/browser/guest_view/surface_worker/surface_worker_guest.cc4
-rw-r--r--extensions/browser/guest_view/surface_worker/surface_worker_guest.h7
-rw-r--r--extensions/browser/guest_view/web_view/javascript_dialog_helper.cc4
-rw-r--r--extensions/browser/guest_view/web_view/web_view_apitest.cc11
-rw-r--r--extensions/browser/guest_view/web_view/web_view_apitest.h11
-rw-r--r--extensions/browser/guest_view/web_view/web_view_content_script_manager.cc2
-rw-r--r--extensions/browser/guest_view/web_view/web_view_find_helper.cc4
-rw-r--r--extensions/browser/guest_view/web_view/web_view_guest.cc33
-rw-r--r--extensions/browser/guest_view/web_view/web_view_guest.h6
-rw-r--r--extensions/browser/guest_view/web_view/web_view_guest_delegate.h2
-rw-r--r--extensions/browser/guest_view/web_view/web_view_permission_helper.cc7
-rw-r--r--extensions/browser/guest_view/web_view/web_view_permission_helper.h2
-rw-r--r--extensions/common/extension_message_generator.h1
-rw-r--r--extensions/extensions.gyp2
-rw-r--r--extensions/extensions.gypi16
-rw-r--r--extensions/extensions_tests.gyp2
-rw-r--r--extensions/extensions_tests.gypi1
-rw-r--r--extensions/renderer/guest_view/extensions_guest_view_container.cc6
-rw-r--r--extensions/renderer/guest_view/guest_view_container.cc8
-rw-r--r--extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc4
-rw-r--r--extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc8
-rw-r--r--extensions/renderer/messaging_bindings.cc2
-rw-r--r--extensions/shell/BUILD.gn1
-rw-r--r--extensions/shell/browser/shell_browser_context.cc4
-rw-r--r--extensions/shell/browser/shell_content_browser_client.cc9
109 files changed, 613 insertions, 404 deletions
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index fc384b7..e9099db 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -99,6 +99,7 @@ source_set("browser") {
"//components/favicon_base",
"//components/gcm_driver",
"//components/google/core/browser",
+ "//components/guest_view:guest_view",
"//components/handoff",
"//components/history/core/browser",
"//components/history/core/common",
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index 8247a70..f1bfe73 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -42,6 +42,7 @@ include_rules = [
"+components/gcm_driver",
"+components/google",
"+components/grit",
+ "+components/guest_view",
"+components/handoff",
"+components/history",
"+components/infobars",
diff --git a/chrome/browser/apps/guest_view/app_view_browsertest.cc b/chrome/browser/apps/guest_view/app_view_browsertest.cc
index 9a6ba6b..d3e8700 100644
--- a/chrome/browser/apps/guest_view/app_view_browsertest.cc
+++ b/chrome/browser/apps/guest_view/app_view_browsertest.cc
@@ -4,23 +4,26 @@
#include "base/strings/stringprintf.h"
#include "chrome/browser/apps/app_browsertest_util.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "components/guest_view/browser/guest_view_manager_factory.h"
+#include "components/guest_view/browser/test_guest_view_manager.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 "extensions/browser/guest_view/test_guest_view_manager.h"
#include "extensions/common/switches.h"
#include "extensions/test/extension_test_message_listener.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"
+using guest_view::GuestViewManager;
+using guest_view::TestGuestViewManagerFactory;
+
class AppViewTest : public extensions::PlatformAppBrowserTest {
public:
AppViewTest() {
- extensions::GuestViewManager::set_factory_for_testing(&factory_);
+ GuestViewManager::set_factory_for_testing(&factory_);
}
enum TestServer {
@@ -70,7 +73,7 @@ class AppViewTest : public extensions::PlatformAppBrowserTest {
extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line);
}
- extensions::TestGuestViewManagerFactory factory_;
+ TestGuestViewManagerFactory factory_;
};
// Tests that <appview> is able to navigate to another installed app.
diff --git a/chrome/browser/apps/guest_view/extension_view/extension_view_browsertest.cc b/chrome/browser/apps/guest_view/extension_view/extension_view_browsertest.cc
index 22c64a4..a0a0824 100644
--- a/chrome/browser/apps/guest_view/extension_view/extension_view_browsertest.cc
+++ b/chrome/browser/apps/guest_view/extension_view/extension_view_browsertest.cc
@@ -5,24 +5,25 @@
#include "base/strings/stringprintf.h"
#include "chrome/browser/apps/app_browsertest_util.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "components/guest_view/browser/guest_view_manager_factory.h"
+#include "components/guest_view/browser/test_guest_view_manager.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
-#include "extensions/browser/guest_view/guest_view_manager_factory.h"
-#include "extensions/browser/guest_view/test_guest_view_manager.h"
#include "extensions/test/extension_test_message_listener.h"
using extensions::ExtensionsGuestViewManagerDelegate;
-using extensions::GuestViewManager;
-using extensions::TestGuestViewManager;
+using guest_view::GuestViewManager;
+using guest_view::TestGuestViewManager;
+using guest_view::TestGuestViewManagerFactory;
class ExtensionViewTest : public extensions::PlatformAppBrowserTest {
public:
ExtensionViewTest() {
- extensions::GuestViewManager::set_factory_for_testing(&factory_);
+ GuestViewManager::set_factory_for_testing(&factory_);
}
- extensions::TestGuestViewManager* GetGuestViewManager() {
+ TestGuestViewManager* GetGuestViewManager() {
TestGuestViewManager* manager = static_cast<TestGuestViewManager*>(
TestGuestViewManager::FromBrowserContext(browser()->profile()));
// TestGuestViewManager::WaitForSingleGuestCreated may and will get called
@@ -31,7 +32,7 @@ class ExtensionViewTest : public extensions::PlatformAppBrowserTest {
manager = static_cast<TestGuestViewManager*>(
GuestViewManager::CreateWithDelegate(
browser()->profile(),
- scoped_ptr<guestview::GuestViewManagerDelegate>(
+ scoped_ptr<guest_view::GuestViewManagerDelegate>(
new ExtensionsGuestViewManagerDelegate(
browser()->profile()))));
}
@@ -70,7 +71,7 @@ class ExtensionViewTest : public extensions::PlatformAppBrowserTest {
extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line);
}
- extensions::TestGuestViewManagerFactory factory_;
+ TestGuestViewManagerFactory factory_;
};
// Tests that <extensionview> can be created and added to the DOM.
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc
index fdb6586..391b4ce 100644
--- a/chrome/browser/apps/guest_view/web_view_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc
@@ -21,6 +21,9 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "components/guest_view/browser/guest_view_manager_factory.h"
+#include "components/guest_view/browser/test_guest_view_manager.h"
#include "content/public/browser/gpu_data_manager.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/interstitial_page_delegate.h"
@@ -37,9 +40,6 @@
#include "extensions/browser/api/declarative_webrequest/webrequest_constants.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
-#include "extensions/browser/guest_view/guest_view_manager_factory.h"
-#include "extensions/browser/guest_view/test_guest_view_manager.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/common/extension.h"
#include "extensions/common/extensions_client.h"
@@ -69,9 +69,10 @@
using extensions::ContextMenuMatcher;
using extensions::ExtensionsGuestViewManagerDelegate;
-using extensions::GuestViewManager;
-using extensions::TestGuestViewManager;
using extensions::MenuItem;
+using guest_view::GuestViewManager;
+using guest_view::TestGuestViewManager;
+using guest_view::TestGuestViewManagerFactory;
using prerender::PrerenderLinkManager;
using prerender::PrerenderLinkManagerFactory;
using task_manager::browsertest_util::MatchAboutBlankTab;
@@ -812,7 +813,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest {
manager = static_cast<TestGuestViewManager*>(
GuestViewManager::CreateWithDelegate(
browser()->profile(),
- scoped_ptr<guestview::GuestViewManagerDelegate>(
+ scoped_ptr<guest_view::GuestViewManagerDelegate>(
new ExtensionsGuestViewManagerDelegate(
browser()->profile()))));
}
@@ -821,7 +822,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest {
WebViewTest() : guest_web_contents_(NULL),
embedder_web_contents_(NULL) {
- extensions::GuestViewManager::set_factory_for_testing(&factory_);
+ GuestViewManager::set_factory_for_testing(&factory_);
}
private:
@@ -837,7 +838,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest {
scoped_ptr<content::FakeSpeechRecognitionManager>
fake_speech_recognition_manager_;
- extensions::TestGuestViewManagerFactory factory_;
+ TestGuestViewManagerFactory factory_;
// Note that these are only set if you launch app using LoadAppWithGuest().
content::WebContents* guest_web_contents_;
content::WebContents* embedder_web_contents_;
diff --git a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
index eb45f11..8800d5f 100644
--- a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
@@ -13,6 +13,10 @@
#include "chrome/test/base/interactive_test_utils.h"
#include "chrome/test/base/test_launcher_utils.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "components/guest_view/browser/guest_view_base.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "components/guest_view/browser/guest_view_manager_factory.h"
+#include "components/guest_view/browser/test_guest_view_manager.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
@@ -24,10 +28,6 @@
#include "extensions/browser/app_window/app_window.h"
#include "extensions/browser/app_window/app_window_registry.h"
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.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 "extensions/browser/guest_view/test_guest_view_manager.h"
#include "extensions/test/extension_test_message_listener.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "ui/base/ime/composition_text.h"
@@ -37,8 +37,10 @@
using extensions::AppWindow;
using extensions::ExtensionsGuestViewManagerDelegate;
-using extensions::GuestViewManager;
-using extensions::TestGuestViewManager;
+using guest_view::GuestViewBase;
+using guest_view::GuestViewManager;
+using guest_view::TestGuestViewManager;
+using guest_view::TestGuestViewManagerFactory;
class WebViewInteractiveTest
: public extensions::PlatformAppBrowserTest {
@@ -49,7 +51,7 @@ class WebViewInteractiveTest
corner_(gfx::Point()),
mouse_click_result_(false),
first_click_(true) {
- extensions::GuestViewManager::set_factory_for_testing(&factory_);
+ GuestViewManager::set_factory_for_testing(&factory_);
}
TestGuestViewManager* GetGuestViewManager() {
@@ -61,7 +63,7 @@ class WebViewInteractiveTest
manager = static_cast<TestGuestViewManager*>(
GuestViewManager::CreateWithDelegate(
browser()->profile(),
- scoped_ptr<guestview::GuestViewManagerDelegate>(
+ scoped_ptr<guest_view::GuestViewManagerDelegate>(
new ExtensionsGuestViewManagerDelegate(
browser()->profile()))));
}
@@ -244,7 +246,7 @@ class WebViewInteractiveTest
guest_web_contents_ = source->GetWebContents();
embedder_web_contents_ =
- extensions::GuestViewBase::FromWebContents(guest_web_contents_)->
+ GuestViewBase::FromWebContents(guest_web_contents_)->
embedder_web_contents();
gfx::Rect offset = embedder_web_contents_->GetContainerBounds();
@@ -480,7 +482,7 @@ class WebViewInteractiveTest
}
protected:
- extensions::TestGuestViewManagerFactory factory_;
+ TestGuestViewManagerFactory factory_;
content::WebContents* guest_web_contents_;
content::WebContents* embedder_web_contents_;
gfx::Point corner_;
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 75a40bc..183dad8 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -210,9 +210,9 @@
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/media/cast_transport_host_filter.h"
#include "chrome/browser/speech/extension_api/tts_engine_extension_api.h"
+#include "components/guest_view/browser/guest_view_base.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "extensions/browser/extension_registry.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
diff --git a/chrome/browser/chromeos/login/helper.cc b/chrome/browser/chromeos/login/helper.cc
index afdd741..d84fd48 100644
--- a/chrome/browser/chromeos/login/helper.cc
+++ b/chrome/browser/chromeos/login/helper.cc
@@ -18,9 +18,9 @@
#include "chromeos/network/network_handler.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "ui/base/l10n/l10n_util.h"
@@ -65,8 +65,8 @@ bool FindGuestByPartitionName(const std::string& partition_name,
// a matching partition could not be found.
content::StoragePartition* GetPartition(content::WebContents* embedder,
const std::string& partition_name) {
- extensions::GuestViewManager* manager =
- extensions::GuestViewManager::FromBrowserContext(
+ guest_view::GuestViewManager* manager =
+ guest_view::GuestViewManager::FromBrowserContext(
embedder->GetBrowserContext());
if (!manager)
return nullptr;
diff --git a/chrome/browser/chromeos/profiles/profile_helper.cc b/chrome/browser/chromeos/profiles/profile_helper.cc
index a68b491..cb7f6e2 100644
--- a/chrome/browser/chromeos/profiles/profile_helper.cc
+++ b/chrome/browser/chromeos/profiles/profile_helper.cc
@@ -17,12 +17,12 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chromeos/chromeos_switches.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
namespace chromeos {
diff --git a/chrome/browser/devtools/devtools_target_impl.cc b/chrome/browser/devtools/devtools_target_impl.cc
index 198c93a..5658553 100644
--- a/chrome/browser/devtools/devtools_target_impl.cc
+++ b/chrome/browser/devtools/devtools_target_impl.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/ui/tab_contents/tab_contents_iterator.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include "chrome/common/extensions/extension_constants.h"
+#include "components/guest_view/browser/guest_view_base.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/favicon_status.h"
@@ -20,7 +21,6 @@
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_registry.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
#include "extensions/browser/process_manager.h"
#include "extensions/common/constants.h"
@@ -60,8 +60,8 @@ WebContentsTarget::WebContentsTarget(WebContents* web_contents, bool is_tab)
tab_id_(-1) {
set_type(kTargetTypeOther);
- extensions::GuestViewBase* guest =
- extensions::GuestViewBase::FromWebContents(web_contents);
+ guest_view::GuestViewBase* guest =
+ guest_view::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/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc
index a9692b9..f406ec2 100644
--- a/chrome/browser/extensions/api/identity/identity_apitest.cc
+++ b/chrome/browser/extensions/api/identity/identity_apitest.cc
@@ -34,6 +34,7 @@
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/test_switches.h"
#include "components/crx_file/id_util.h"
+#include "components/guest_view/browser/guest_view_base.h"
#include "components/signin/core/browser/account_tracker_service.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/signin/core/common/profile_management_switches.h"
@@ -42,7 +43,6 @@
#include "content/public/browser/notification_source.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/api_test_utils.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
#include "extensions/common/manifest_handlers/oauth2_manifest_handler.h"
#include "extensions/common/test_util.h"
#include "google_apis/gaia/google_service_auth_error.h"
@@ -52,6 +52,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
+using guest_view::GuestViewBase;
using testing::_;
using testing::Return;
using testing::ReturnRef;
diff --git a/chrome/browser/extensions/api/identity/web_auth_flow.cc b/chrome/browser/extensions/api/identity/web_auth_flow.cc
index a1573a0..ac4d1aa 100644
--- a/chrome/browser/extensions/api/identity/web_auth_flow.cc
+++ b/chrome/browser/extensions/api/identity/web_auth_flow.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/identity_private.h"
#include "chrome/common/extensions/extension_constants.h"
+#include "components/guest_view/browser/guest_view_base.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_details.h"
@@ -28,7 +29,6 @@
#include "extensions/browser/app_window/app_window.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"
@@ -36,6 +36,7 @@ using content::RenderViewHost;
using content::ResourceRedirectDetails;
using content::WebContents;
using content::WebContentsObserver;
+using guest_view::GuestViewBase;
namespace extensions {
diff --git a/chrome/browser/extensions/api/messaging/message_service.cc b/chrome/browser/extensions/api/messaging/message_service.cc
index a300b98b..0372d63 100644
--- a/chrome/browser/extensions/api/messaging/message_service.cc
+++ b/chrome/browser/extensions/api/messaging/message_service.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/tab_util.h"
+#include "components/guest_view/common/guest_view_constants.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
@@ -41,7 +42,6 @@
#include "extensions/browser/pref_names.h"
#include "extensions/browser/process_manager.h"
#include "extensions/common/extension.h"
-#include "extensions/common/guest_view/guest_view_constants.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/background_info.h"
#include "extensions/common/manifest_handlers/externally_connectable.h"
diff --git a/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc b/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
index 8f6cf68..360594d 100644
--- a/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
+++ b/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
@@ -21,6 +21,7 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/extensions/extension_process_policy.h"
#include "chrome/common/extensions/manifest_handlers/app_isolation_info.h"
+#include "components/guest_view/browser/guest_view_message_filter.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/browser_url_handler.h"
#include "content/public/browser/render_process_host.h"
@@ -35,7 +36,6 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
-#include "extensions/browser/guest_view/guest_view_message_filter.h"
#include "extensions/browser/info_map.h"
#include "extensions/browser/io_thread_extension_message_filter.h"
#include "extensions/browser/view_type_utils.h"
@@ -380,7 +380,7 @@ void ChromeContentBrowserClientExtensionsPart::RenderProcessWillLaunch(
host->AddFilter(new ExtensionMessageFilter(id, profile));
host->AddFilter(new IOThreadExtensionMessageFilter(id, profile));
host->AddFilter(new ExtensionsGuestViewMessageFilter(id, profile));
- host->AddFilter(new GuestViewMessageFilter(id, profile));
+ host->AddFilter(new guest_view::GuestViewMessageFilter(id, profile));
extension_web_request_api_helpers::SendExtensionWebRequestStatusToHost(host);
}
diff --git a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc
index ffdb52d..170a561 100644
--- a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc
+++ b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc
@@ -11,11 +11,12 @@
#include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
#include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h"
#include "chrome/common/chrome_version_info.h"
+#include "components/browsing_data/storage_partition_http_cache_data_remover.h"
+#include "components/guest_view/browser/guest_view_event.h"
#include "components/pdf/browser/pdf_web_contents_helper.h"
#include "components/renderer_context_menu/context_menu_delegate.h"
#include "content/public/browser/render_process_host.h"
#include "extensions/browser/api/web_request/web_request_api.h"
-#include "extensions/browser/guest_view/guest_view_event.h"
#include "extensions/browser/guest_view/web_view/web_view_constants.h"
#if defined(ENABLE_PRINTING)
@@ -27,6 +28,8 @@
#endif // defined(ENABLE_PRINT_PREVIEW)
#endif // defined(ENABLE_PRINTING)
+using guest_view::GuestViewEvent;
+
namespace extensions {
ChromeWebViewGuestDelegate::ChromeWebViewGuestDelegate(
diff --git a/chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.cc b/chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.cc
index 916dcd0..3e6eaa1 100644
--- a/chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.cc
+++ b/chrome/browser/guest_view/web_view/chrome_web_view_permission_helper_delegate.cc
@@ -132,7 +132,7 @@ void ChromeWebViewPermissionHelperDelegate::CanDownload(
const std::string& request_method,
const base::Callback<void(bool)>& callback) {
base::DictionaryValue request_info;
- request_info.SetString(guestview::kUrl, url.spec());
+ request_info.SetString(guest_view::kUrl, url.spec());
web_view_permission_helper()->RequestPermission(
WEB_VIEW_PERMISSION_TYPE_DOWNLOAD,
request_info,
@@ -155,10 +155,10 @@ void ChromeWebViewPermissionHelperDelegate::RequestPointerLockPermission(
bool last_unlocked_by_target,
const base::Callback<void(bool)>& callback) {
base::DictionaryValue request_info;
- request_info.SetBoolean(guestview::kUserGesture, user_gesture);
+ request_info.SetBoolean(guest_view::kUserGesture, user_gesture);
request_info.SetBoolean(webview::kLastUnlockedBySelf,
last_unlocked_by_target);
- request_info.SetString(guestview::kUrl,
+ request_info.SetString(guest_view::kUrl,
web_contents()->GetLastCommittedURL().spec());
web_view_permission_helper()->RequestPermission(
@@ -184,8 +184,8 @@ void ChromeWebViewPermissionHelperDelegate::RequestGeolocationPermission(
bool user_gesture,
const base::Callback<void(bool)>& callback) {
base::DictionaryValue request_info;
- request_info.SetString(guestview::kUrl, requesting_frame.spec());
- request_info.SetBoolean(guestview::kUserGesture, user_gesture);
+ request_info.SetString(guest_view::kUrl, requesting_frame.spec());
+ request_info.SetBoolean(guest_view::kUserGesture, user_gesture);
// It is safe to hold an unretained pointer to
// ChromeWebViewPermissionHelperDelegate because this callback is called from
@@ -268,7 +268,7 @@ void ChromeWebViewPermissionHelperDelegate::RequestFileSystemPermission(
bool allowed_by_default,
const base::Callback<void(bool)>& callback) {
base::DictionaryValue request_info;
- request_info.SetString(guestview::kUrl, url.spec());
+ request_info.SetString(guest_view::kUrl, url.spec());
web_view_permission_helper()->RequestPermission(
WEB_VIEW_PERMISSION_TYPE_FILESYSTEM,
request_info,
diff --git a/chrome/browser/plugins/plugin_info_message_filter.cc b/chrome/browser/plugins/plugin_info_message_filter.cc
index 03c30a5..cd775fe 100644
--- a/chrome/browser/plugins/plugin_info_message_filter.cc
+++ b/chrome/browser/plugins/plugin_info_message_filter.cc
@@ -34,8 +34,8 @@
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
#if defined(ENABLE_EXTENSIONS)
+#include "components/guest_view/browser/guest_view_base.h"
#include "extensions/browser/extension_registry.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
diff --git a/chrome/browser/prerender/prerender_link_manager.cc b/chrome/browser/prerender/prerender_link_manager.cc
index f9aa403..d4d3797 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 "extensions/browser/guest_view/guest_view_base.h"
+#include "components/guest_view/browser/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 (extensions::GuestViewBase::IsGuest(web_contents))
+ if (guest_view::GuestViewBase::IsGuest(web_contents))
return;
#endif
diff --git a/chrome/browser/printing/print_preview_dialog_controller.cc b/chrome/browser/printing/print_preview_dialog_controller.cc
index 618c383..8d1ff32 100644
--- a/chrome/browser/printing/print_preview_dialog_controller.cc
+++ b/chrome/browser/printing/print_preview_dialog_controller.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
+#include "components/guest_view/browser/guest_view_base.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/navigation_controller.h"
@@ -35,7 +36,6 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
#include "ui/web_dialogs/web_dialog_delegate.h"
using content::NavigationController;
@@ -101,14 +101,8 @@ void PrintPreviewDialogDelegate::GetDialogSize(gfx::Size* size) const {
*size = kMinDialogSize;
web_modal::WebContentsModalDialogHost* host = NULL;
- content::WebContents* outermost_web_contents = initiator_;
- const extensions::GuestViewBase* guest_view =
- extensions::GuestViewBase::FromWebContents(outermost_web_contents);
- while (guest_view && guest_view->attached()) {
- outermost_web_contents = guest_view->embedder_web_contents();
- guest_view =
- extensions::GuestViewBase::FromWebContents(outermost_web_contents);
- }
+ content::WebContents* outermost_web_contents =
+ guest_view::GuestViewBase::GetTopLevelWebContents(initiator_);
Browser* browser = chrome::FindBrowserWithWebContents(outermost_web_contents);
if (browser)
host = browser->window()->GetWebContentsModalDialogHost();
diff --git a/chrome/browser/printing/print_view_manager_common.cc b/chrome/browser/printing/print_view_manager_common.cc
index 7f8ad12..1d1a2c3 100644
--- a/chrome/browser/printing/print_view_manager_common.cc
+++ b/chrome/browser/printing/print_view_manager_common.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/printing/print_view_manager_common.h"
#if defined(ENABLE_EXTENSIONS)
-#include "extensions/browser/guest_view/guest_view_manager.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
#endif // defined(ENABLE_EXTENSIONS)
@@ -36,8 +36,8 @@ bool StoreFullPagePlugin(content::WebContents** result,
// guest's WebContents instead.
content::WebContents* GetWebContentsToUse(content::WebContents* contents) {
#if defined(ENABLE_EXTENSIONS)
- extensions::GuestViewManager* guest_view_manager =
- extensions::GuestViewManager::FromBrowserContext(
+ guest_view::GuestViewManager* guest_view_manager =
+ guest_view::GuestViewManager::FromBrowserContext(
contents->GetBrowserContext());
if (guest_view_manager) {
guest_view_manager->ForEachGuest(
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc
index a363530..02ece36 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -76,9 +76,9 @@
#if defined(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_special_storage_policy.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "extensions/browser/api/web_request/web_request_api.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "extensions/common/extension.h"
#endif
@@ -415,7 +415,7 @@ HostContentSettingsMap* OffTheRecordProfileImpl::GetHostContentSettingsMap() {
content::BrowserPluginGuestManager* OffTheRecordProfileImpl::GetGuestManager() {
#if defined(ENABLE_EXTENSIONS)
- return extensions::GuestViewManager::FromBrowserContext(this);
+ return guest_view::GuestViewManager::FromBrowserContext(this);
#else
return NULL;
#endif
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index a491300..f1767ec 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -137,11 +137,11 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_special_storage_policy.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
+#include "components/guest_view/browser/guest_view_manager.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_SUPERVISED_USERS)
@@ -1014,7 +1014,7 @@ HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() {
content::BrowserPluginGuestManager* ProfileImpl::GetGuestManager() {
#if defined(ENABLE_EXTENSIONS)
- return extensions::GuestViewManager::FromBrowserContext(this);
+ return guest_view::GuestViewManager::FromBrowserContext(this);
#else
return NULL;
#endif
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 4020c65..c3cc583 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -317,7 +317,7 @@ gfx::Vector2d RenderViewContextMenu::GetOffset(
WebContents* web_contents =
WebContents::FromRenderFrameHost(render_frame_host);
WebContents* top_level_web_contents =
- extensions::GuestViewBase::GetTopLevelWebContents(web_contents);
+ guest_view::GuestViewBase::GetTopLevelWebContents(web_contents);
if (web_contents && top_level_web_contents &&
web_contents != top_level_web_contents) {
gfx::Rect bounds = web_contents->GetContainerBounds();
@@ -797,7 +797,7 @@ void RenderViewContextMenu::AppendMediaItems() {
void RenderViewContextMenu::AppendPluginItems() {
if (params_.page_url == params_.src_url ||
- extensions::GuestViewBase::IsGuest(source_web_contents_)) {
+ guest_view::GuestViewBase::IsGuest(source_web_contents_)) {
// Full page plugin, so show page menu items.
if (params_.link_url.is_empty() && params_.selection_text.empty())
AppendPageItems();
diff --git a/chrome/browser/task_manager/extension_information.cc b/chrome/browser/task_manager/extension_information.cc
index df1f0e3..527b7c2 100644
--- a/chrome/browser/task_manager/extension_information.cc
+++ b/chrome/browser/task_manager/extension_information.cc
@@ -11,11 +11,11 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/task_manager/renderer_resource.h"
#include "chrome/browser/task_manager/task_manager_util.h"
+#include "components/guest_view/browser/guest_view_base.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"
#include "content/public/browser/web_contents.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"
@@ -137,7 +137,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 (extensions::GuestViewBase::IsGuest(web_contents))
+ if (guest_view::GuestViewBase::IsGuest(web_contents))
return false;
// Extension WebContents tracked by this class will always host extension
diff --git a/chrome/browser/task_manager/guest_information.cc b/chrome/browser/task_manager/guest_information.cc
index fdfa035..192b3e3 100644
--- a/chrome/browser/task_manager/guest_information.cc
+++ b/chrome/browser/task_manager/guest_information.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/task_manager/task_manager_util.h"
#include "chrome/grit/generated_resources.h"
#include "components/favicon/content/content_favicon_driver.h"
+#include "components/guest_view/browser/guest_view_base.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
@@ -20,7 +21,6 @@
#include "content/public/browser/render_widget_host_iterator.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
#include "extensions/strings/grit/extensions_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/image/image.h"
@@ -31,6 +31,7 @@ using content::RenderViewHost;
using content::RenderWidgetHost;
using content::WebContents;
using extensions::Extension;
+using guest_view::GuestViewBase;
namespace task_manager {
@@ -68,8 +69,7 @@ base::string16 GuestResource::GetTitle() const {
const int message_id = IDS_EXTENSION_TASK_MANAGER_WEBVIEW_TAG_PREFIX;
return l10n_util::GetStringFUTF16(message_id, base::string16());
}
- extensions::GuestViewBase* guest =
- extensions::GuestViewBase::FromWebContents(web_contents);
+ GuestViewBase* guest = GuestViewBase::FromWebContents(web_contents);
return l10n_util::GetStringFUTF16(
guest->GetTaskPrefix(),
util::GetTitleFromWebContents(web_contents));
@@ -100,7 +100,7 @@ GuestInformation::~GuestInformation() {}
bool GuestInformation::CheckOwnership(WebContents* web_contents) {
// Guest WebContentses are created and owned internally by the content layer.
- return extensions::GuestViewBase::IsGuest(web_contents);
+ return GuestViewBase::IsGuest(web_contents);
}
void GuestInformation::GetAll(const NewWebContentsCallback& callback) {
@@ -110,7 +110,7 @@ void GuestInformation::GetAll(const NewWebContentsCallback& callback) {
if (widget->IsRenderView()) {
content::RenderViewHost* rvh = content::RenderViewHost::From(widget);
WebContents* web_contents = WebContents::FromRenderViewHost(rvh);
- if (web_contents && extensions::GuestViewBase::IsGuest(web_contents))
+ if (web_contents && GuestViewBase::IsGuest(web_contents))
callback.Run(web_contents);
}
}
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 0cc3fa0..c40a346 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm
@@ -8,9 +8,9 @@
#include "base/logging.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h"
#import "chrome/browser/ui/cocoa/single_web_contents_dialog_manager_cocoa.h"
+#include "components/guest_view/browser/guest_view_base.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/browser_thread.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
using web_modal::WebContentsModalDialogManager;
@@ -23,12 +23,8 @@ ConstrainedWindowMac::ConstrainedWindowMac(
// |web_contents| may be embedded within a chain of nested GuestViews. If it
// is, follow the chain of embedders to the outermost WebContents and use it.
- while (extensions::GuestViewBase* guest_view =
- extensions::GuestViewBase::FromWebContents(web_contents)) {
- if (!guest_view->embedder_web_contents())
- break;
- web_contents = guest_view->embedder_web_contents();
- }
+ web_contents =
+ guest_view::GuestViewBase::GetTopLevelWebContents(web_contents);
auto manager = WebContentsModalDialogManager::FromWebContents(web_contents);
scoped_ptr<SingleWebContentsDialogManagerCocoa> native_manager(
diff --git a/chrome/browser/ui/login/login_prompt.cc b/chrome/browser/ui/login/login_prompt.cc
index cc9f890..95717d5 100644
--- a/chrome/browser/ui/login/login_prompt.cc
+++ b/chrome/browser/ui/login/login_prompt.cc
@@ -37,7 +37,7 @@
#include "ui/gfx/text_elider.h"
#if defined(ENABLE_EXTENSIONS)
-#include "extensions/browser/guest_view/guest_view_base.h"
+#include "components/guest_view/browser/guest_view_base.h"
#endif
using autofill::PasswordForm;
@@ -494,7 +494,7 @@ void ShowLoginPrompt(const GURL& request_url,
#if defined(ENABLE_EXTENSIONS)
// A WebContents in a <webview> (a GuestView type) does not have a password
// manager, but still needs to be able to show login prompts.
- if (extensions::GuestViewBase::FromWebContents(parent_contents)) {
+ if (guest_view::GuestViewBase::FromWebContents(parent_contents)) {
handler->BuildViewForPasswordManager(nullptr, explanation);
return;
}
diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.cc b/chrome/browser/ui/tab_contents/core_tab_helper.cc
index b2ef8e0..8eb5cb8 100644
--- a/chrome/browser/ui/tab_contents/core_tab_helper.cc
+++ b/chrome/browser/ui/tab_contents/core_tab_helper.cc
@@ -19,13 +19,13 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/render_messages.h"
#include "chrome/grit/generated_resources.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_service.h"
#include "components/web_cache/browser/web_cache_manager.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "net/base/load_states.h"
#include "net/http/http_request_headers.h"
#include "ui/base/l10n/l10n_util.h"
@@ -92,7 +92,7 @@ bool CoreTabHelper::GetStatusTextForWebContents(
tracked_objects::ScopedTracker tracking_profile1(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"467185 CoreTabHelper::GetStatusTextForWebContents1"));
- auto guest_manager = extensions::GuestViewManager::FromBrowserContext(
+ auto guest_manager = guest_view::GuestViewManager::FromBrowserContext(
source->GetBrowserContext());
if (!source->IsLoading() ||
source->GetLoadState().state == net::LOAD_STATE_IDLE) {
diff --git a/chrome/browser/ui/views/chrome_constrained_window_views_client.cc b/chrome/browser/ui/views/chrome_constrained_window_views_client.cc
index 2143f22..a9ca4d9 100644
--- a/chrome/browser/ui/views/chrome_constrained_window_views_client.cc
+++ b/chrome/browser/ui/views/chrome_constrained_window_views_client.cc
@@ -7,7 +7,6 @@
#include "chrome/browser/platform_util.h"
#include "chrome/browser/ui/browser_finder.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
namespace {
@@ -19,11 +18,6 @@ class ChromeConstrainedWindowViewsClient
private:
// ConstrainedWindowViewsClient:
- content::WebContents* GetEmbedderWebContents(
- content::WebContents* initiator_web_contents) override {
- return extensions::GuestViewBase::GetTopLevelWebContents(
- initiator_web_contents);
- }
web_modal::ModalDialogHost* GetModalDialogHost(
gfx::NativeWindow parent) override {
// Get the browser dialog management and hosting components from |parent|.
diff --git a/chrome/browser/ui/webui/signin/inline_login_ui.cc b/chrome/browser/ui/webui/signin/inline_login_ui.cc
index e38d985..843bae5 100644
--- a/chrome/browser/ui/webui/signin/inline_login_ui.cc
+++ b/chrome/browser/ui/webui/signin/inline_login_ui.cc
@@ -16,11 +16,11 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "components/signin/core/common/profile_management_switches.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "grit/browser_resources.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/login/startup_utils.h"
@@ -137,8 +137,8 @@ content::RenderFrameHost* InlineLoginUI::GetAuthFrame(
is_webview = is_webview || chromeos::StartupUtils::IsWebviewSigninEnabled();
#endif
if (is_webview) {
- extensions::GuestViewManager* manager =
- extensions::GuestViewManager::FromBrowserContext(
+ guest_view::GuestViewManager* manager =
+ guest_view::GuestViewManager::FromBrowserContext(
web_contents->GetBrowserContext());
if (manager) {
manager->ForEachGuest(web_contents,
diff --git a/chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc b/chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc
index f34482f..69706a2 100644
--- a/chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/signin/inline_login_ui_browsertest.cc
@@ -25,6 +25,7 @@
#include "chrome/test/base/test_chrome_web_ui_controller_factory.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/signin/core/common/profile_management_switches.h"
#include "components/signin/core/common/signin_pref_names.h"
@@ -37,7 +38,6 @@
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "google_apis/gaia/fake_gaia.h"
#include "google_apis/gaia/gaia_switches.h"
#include "net/base/url_util.h"
@@ -54,6 +54,7 @@ using ::testing::Invoke;
using ::testing::InvokeWithoutArgs;
using ::testing::Return;
+using guest_view::GuestViewManager;
using login_ui_test_utils::ExecuteJsToSigninInSigninFrame;
using login_ui_test_utils::WaitUntilUIReady;
@@ -188,9 +189,8 @@ IN_PROC_BROWSER_TEST_F(InlineLoginUIBrowserTest, MAYBE_DifferentStorageId) {
// Make sure storage partition of embedded webview is different from
// parent.
std::set<content::WebContents*> set;
- extensions::GuestViewManager* manager =
- extensions::GuestViewManager::FromBrowserContext(
- info.contents->GetBrowserContext());
+ GuestViewManager* manager = GuestViewManager::FromBrowserContext(
+ info.contents->GetBrowserContext());
manager->ForEachGuest(info.contents, base::Bind(&AddToSet, &set));
ASSERT_EQ(1u, set.size());
content::WebContents* webview_contents = *set.begin();
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index ff209d7..2e911ed 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -3008,6 +3008,7 @@
'../components/components.gyp:favicon_core',
'../components/components.gyp:gcm_driver',
'../components/components.gyp:google_core_browser',
+ '../components/components.gyp:guest_view',
'../components/components.gyp:handoff',
'../components/components.gyp:history_core_browser',
'../components/components.gyp:history_core_common',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 05732fd..776fd69 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1487,6 +1487,8 @@
'debugger',
'renderer',
'test_support_common',
+ '../components/components.gyp:guest_view',
+ '../components/components.gyp:guest_view_test_support',
'../content/app/resources/content_resources.gyp:content_resources',
'../crypto/crypto.gyp:crypto_test_support',
'../google_apis/google_apis.gyp:google_apis_test_support',
@@ -1976,6 +1978,8 @@
'../components/components.gyp:captive_portal_test_support',
'../components/components.gyp:dom_distiller_content',
'../components/components.gyp:dom_distiller_test_support',
+ '../components/components.gyp:guest_view',
+ '../components/components.gyp:guest_view_test_support',
'../components/components.gyp:translate_core_common',
'../components/components_resources.gyp:components_resources',
'../components/components_strings.gyp:components_strings',
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index 5d8da66..3ad73cc 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -133,6 +133,7 @@ source_set("test_support") {
"//content/public/utility",
"//components/autofill/core/browser:test_support",
"//components/captive_portal:test_support",
+ "//components/guest_view:test_support",
"//components/infobars/core",
"//components/sessions:test_support",
"//components/user_manager:test_support",
@@ -630,6 +631,7 @@ if (!is_android) {
"//components/captive_portal:test_support",
"//components/dom_distiller/content",
"//components/dom_distiller/core:test_support",
+ "//components/guest_view:test_support",
"//components/resources",
"//components/strings",
"//components/translate/core/common",
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 6f3eba8..aee4123 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -103,8 +103,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 "components/guest_view/browser/guest_view_manager.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#endif
#if defined(OS_ANDROID)
@@ -955,7 +955,7 @@ HostContentSettingsMap* TestingProfile::GetHostContentSettingsMap() {
content::BrowserPluginGuestManager* TestingProfile::GetGuestManager() {
#if defined(ENABLE_EXTENSIONS)
- return extensions::GuestViewManager::FromBrowserContext(this);
+ return guest_view::GuestViewManager::FromBrowserContext(this);
#else
return NULL;
#endif
diff --git a/components/BUILD.gn b/components/BUILD.gn
index 66864f0..7821039 100644
--- a/components/BUILD.gn
+++ b/components/BUILD.gn
@@ -48,6 +48,7 @@ group("all_components") {
"//components/feedback",
"//components/gcm_driver",
"//components/google/core/browser",
+ "//components/guest_view:guest_view",
"//components/history/content/browser",
"//components/history/core/browser",
"//components/history/core/common",
diff --git a/components/components.gyp b/components/components.gyp
index f8dee130..b59e82c 100644
--- a/components/components.gyp
+++ b/components/components.gyp
@@ -30,6 +30,7 @@
'favicon_base.gypi',
'gcm_driver.gypi',
'google.gypi',
+ 'guest_view.gypi',
'handoff.gypi',
'history.gypi',
'infobars.gypi',
diff --git a/components/components_tests.gyp b/components/components_tests.gyp
index 26ef376..2ee73c9 100644
--- a/components/components_tests.gyp
+++ b/components/components_tests.gyp
@@ -217,6 +217,9 @@
'google/core/browser/google_url_tracker_unittest.cc',
'google/core/browser/google_util_unittest.cc',
],
+ 'guest_view_unittest_sources': [
+ 'guest_view/browser/guest_view_manager_unittest.cc'
+ ],
'history_unittest_sources': [
'history/content/browser/content_history_backend_unittest.cc',
'history/core/browser/android/android_history_types_unittest.cc',
@@ -755,6 +758,8 @@
'components.gyp:gcm_driver',
'components.gyp:gcm_driver_test_support',
'components.gyp:google_core_browser',
+ 'components.gyp:guest_view',
+ 'components.gyp:guest_view_test_support',
'components.gyp:history_core_browser',
'components.gyp:history_core_common',
'components.gyp:history_core_test_support',
@@ -844,6 +849,7 @@
'sources': [
'<@(devtools_http_handler_unittest_sources)',
'<@(error_page_unittest_sources)',
+ '<@(guest_view_unittest_sources)',
'<@(navigation_interception_unittest_sources)',
'<@(network_hints_unittest_sources)',
'<@(power_unittest_sources)',
diff --git a/components/constrained_window/BUILD.gn b/components/constrained_window/BUILD.gn
index cbbb36f..55aae21 100644
--- a/components/constrained_window/BUILD.gn
+++ b/components/constrained_window/BUILD.gn
@@ -10,6 +10,7 @@ static_library("constrained_window") {
]
deps = [
+ "//components/guest_view:guest_view",
"//components/web_modal",
"//ui/views",
"//skia",
diff --git a/components/constrained_window/DEPS b/components/constrained_window/DEPS
index 9f4c9d1..9ddd155 100644
--- a/components/constrained_window/DEPS
+++ b/components/constrained_window/DEPS
@@ -1,4 +1,5 @@
include_rules = [
+ "+components/guest_view",
"+components/web_modal",
"+ui/base",
"+ui/gfx",
diff --git a/components/constrained_window/constrained_window_views.cc b/components/constrained_window/constrained_window_views.cc
index 577ee03..2f3c3da 100644
--- a/components/constrained_window/constrained_window_views.cc
+++ b/components/constrained_window/constrained_window_views.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "components/constrained_window/constrained_window_views_client.h"
+#include "components/guest_view/browser/guest_view_base.h"
#include "components/web_modal/popup_manager.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
#include "ui/views/border.h"
@@ -134,8 +135,8 @@ views::Widget* ShowWebModalDialogViews(
DCHECK(constrained_window_views_client);
// For embedded WebContents, use the embedder's WebContents for constrained
// window.
- content::WebContents* web_contents = constrained_window_views_client->
- GetEmbedderWebContents(initiator_web_contents);
+ content::WebContents* web_contents =
+ guest_view::GuestViewBase::GetTopLevelWebContents(initiator_web_contents);
views::Widget* widget = CreateWebModalDialogViews(dialog, web_contents);
web_modal::PopupManager* popup_manager =
web_modal::PopupManager::FromWebContents(web_contents);
diff --git a/components/constrained_window/constrained_window_views_client.h b/components/constrained_window/constrained_window_views_client.h
index c5b1860..de58b2c 100644
--- a/components/constrained_window/constrained_window_views_client.h
+++ b/components/constrained_window/constrained_window_views_client.h
@@ -21,11 +21,6 @@ class ConstrainedWindowViewsClient {
public:
virtual ~ConstrainedWindowViewsClient() {}
- // Returns the web contents that a constrained window should be modal to
- // in the embedder's context.
- virtual content::WebContents* GetEmbedderWebContents(
- content::WebContents* initiator_web_contents) = 0;
-
// Returns the modal window host for the |parent| native window.
virtual web_modal::ModalDialogHost* GetModalDialogHost(
gfx::NativeWindow parent) = 0;
diff --git a/components/guest_view.gypi b/components/guest_view.gypi
new file mode 100644
index 0000000..dbbddcc
--- /dev/null
+++ b/components/guest_view.gypi
@@ -0,0 +1,55 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+{
+ 'targets': [
+ {
+ 'target_name': 'guest_view',
+ 'type': 'static_library',
+ 'dependencies': [
+ '../base/base.gyp:base',
+ '../content/content.gyp:content_browser',
+ '../content/content.gyp:content_common',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'sources': [
+ 'guest_view/browser/guest_view.h',
+ 'guest_view/browser/guest_view_base.cc',
+ 'guest_view/browser/guest_view_base.h',
+ 'guest_view/browser/guest_view_event.cc',
+ 'guest_view/browser/guest_view_event.h',
+ 'guest_view/browser/guest_view_manager.cc',
+ 'guest_view/browser/guest_view_manager.h',
+ 'guest_view/browser/guest_view_manager_delegate.cc',
+ 'guest_view/browser/guest_view_manager_delegate.h',
+ 'guest_view/browser/guest_view_manager_factory.h',
+ 'guest_view/browser/guest_view_message_filter.cc',
+ 'guest_view/browser/guest_view_message_filter.h',
+ 'guest_view/common/guest_view_constants.cc',
+ 'guest_view/common/guest_view_constants.h',
+ 'guest_view/common/guest_view_message_generator.cc',
+ 'guest_view/common/guest_view_message_generator.h'
+ 'guest_view/common/guest_view_messages.h',
+ ],
+ },
+ {
+ 'target_name': 'guest_view_test_support',
+ 'type': 'static_library',
+ 'dependencies': [
+ '../base/base.gyp:base',
+ '../content/content.gyp:content_browser',
+ '../content/content.gyp:content_common',
+ '../content/content_shell_and_tests.gyp:test_support_content',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'sources': [
+ 'guest_view/browser/test_guest_view_manager.h',
+ 'guest_view/browser/test_guest_view_manager.cc',
+ ],
+ }
+ ],
+}
diff --git a/components/guest_view/BUILD.gn b/components/guest_view/BUILD.gn
new file mode 100644
index 0000000..0beda18
--- /dev/null
+++ b/components/guest_view/BUILD.gn
@@ -0,0 +1,46 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+static_library("guest_view") {
+ output_name = "guest_view"
+ sources = [
+ "//components/guest_view/browser/guest_view.h",
+ "//components/guest_view/browser/guest_view_base.cc",
+ "//components/guest_view/browser/guest_view_base.h",
+ "//components/guest_view/browser/guest_view_event.cc",
+ "//components/guest_view/browser/guest_view_event.h",
+ "//components/guest_view/browser/guest_view_manager.cc",
+ "//components/guest_view/browser/guest_view_manager.h",
+ "//components/guest_view/browser/guest_view_manager_delegate.cc",
+ "//components/guest_view/browser/guest_view_manager_delegate.h",
+ "//components/guest_view/browser/guest_view_manager_factory.h",
+ "//components/guest_view/browser/guest_view_message_filter.cc",
+ "//components/guest_view/browser/guest_view_message_filter.h",
+ "//components/guest_view/common/guest_view_constants.cc",
+ "//components/guest_view/common/guest_view_constants.h",
+ "//components/guest_view/common/guest_view_message_generator.cc",
+ "//components/guest_view/common/guest_view_message_generator.h",
+ "//components/guest_view/common/guest_view_messages.h",
+ ]
+
+ deps = [
+ "//base",
+ "//content/public/browser",
+ "//content/public/common",
+ "//third_party/WebKit/public:blink",
+ ]
+}
+
+static_library("test_support") {
+ testonly = true
+ sources = [
+ "//components/guest_view/browser/test_guest_view_manager.cc",
+ "//components/guest_view/browser/test_guest_view_manager.h",
+ ]
+
+ deps = [
+ ":guest_view",
+ "//content/test:test_support",
+ ]
+}
diff --git a/components/guest_view/OWNERS b/components/guest_view/OWNERS
new file mode 100644
index 0000000..f9575e8
--- /dev/null
+++ b/components/guest_view/OWNERS
@@ -0,0 +1,3 @@
+fsamuel@chromium.org
+lazyboy@chromium.org
+hanxi@chromium.org
diff --git a/components/guest_view/browser/DEPS b/components/guest_view/browser/DEPS
new file mode 100644
index 0000000..f0c51e4
--- /dev/null
+++ b/components/guest_view/browser/DEPS
@@ -0,0 +1,8 @@
+include_rules = [
+ "+components/ui/zoom",
+ "+content/public/browser",
+ "+content/public/common",
+ "+content/public/test",
+ "+ipc",
+ '+third_party/WebKit/public/web/WebInputEvent.h',
+]
diff --git a/extensions/browser/guest_view/guest_view.h b/components/guest_view/browser/guest_view.h
index eaa5602..f99fe83 100644
--- a/extensions/browser/guest_view/guest_view.h
+++ b/components/guest_view/browser/guest_view.h
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_H_
-#define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_H_
+#ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_H_
+#define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_H_
+#include "components/guest_view/browser/guest_view_base.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "content/public/browser/render_frame_host.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
-namespace extensions {
+namespace guest_view {
// 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-
@@ -65,6 +65,6 @@ class GuestView : public GuestViewBase {
DISALLOW_COPY_AND_ASSIGN(GuestView);
};
-} // namespace extensions
+} // namespace guest_view
-#endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_H_
+#endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_H_
diff --git a/extensions/browser/guest_view/guest_view_base.cc b/components/guest_view/browser/guest_view_base.cc
index ad03214..1b1b5ed 100644
--- a/extensions/browser/guest_view/guest_view_base.cc
+++ b/components/guest_view/browser/guest_view_base.cc
@@ -2,10 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/browser/guest_view/guest_view_base.h"
+#include "components/guest_view/browser/guest_view_base.h"
#include "base/lazy_instance.h"
#include "base/strings/utf_string_conversions.h"
+#include "components/guest_view/browser/guest_view_event.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "components/guest_view/common/guest_view_constants.h"
+#include "components/guest_view/common/guest_view_messages.h"
#include "components/ui/zoom/page_zoom.h"
#include "components/ui/zoom/zoom_controller.h"
#include "content/public/browser/navigation_details.h"
@@ -16,10 +20,6 @@
#include "content/public/browser/web_contents.h"
#include "content/public/common/page_zoom.h"
#include "content/public/common/url_constants.h"
-#include "extensions/browser/guest_view/guest_view_event.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
-#include "extensions/common/guest_view/guest_view_constants.h"
-#include "extensions/common/guest_view/guest_view_messages.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
using content::WebContents;
@@ -28,7 +28,7 @@ namespace content {
struct FrameNavigateParams;
}
-namespace extensions {
+namespace guest_view {
namespace {
@@ -148,8 +148,8 @@ GuestViewBase::GuestViewBase(content::WebContents* owner_web_contents)
guest_instance_id_(
GuestViewManager::FromBrowserContext(browser_context_)->
GetNextInstanceID()),
- view_instance_id_(guestview::kInstanceIDNone),
- element_instance_id_(guestview::kInstanceIDNone),
+ view_instance_id_(kInstanceIDNone),
+ element_instance_id_(kInstanceIDNone),
initialized_(false),
is_being_destroyed_(false),
guest_host_(nullptr),
@@ -215,8 +215,7 @@ void GuestViewBase::InitWithWebContents(
AddGuest(guest_instance_id_, guest_web_contents);
// Populate the view instance ID if we have it on creation.
- create_params.GetInteger(guestview::kParameterInstanceId,
- &view_instance_id_);
+ create_params.GetInteger(kParameterInstanceId, &view_instance_id_);
if (CanRunInDetachedState())
SetUpSizing(create_params);
@@ -245,12 +244,11 @@ void GuestViewBase::DispatchOnResizeEvent(const gfx::Size& old_size,
// Dispatch the onResize event.
scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
- args->SetInteger(guestview::kOldWidth, old_size.width());
- args->SetInteger(guestview::kOldHeight, old_size.height());
- args->SetInteger(guestview::kNewWidth, new_size.width());
- args->SetInteger(guestview::kNewHeight, new_size.height());
- DispatchEventToGuestProxy(
- new GuestViewEvent(guestview::kEventResize, args.Pass()));
+ args->SetInteger(kOldWidth, old_size.width());
+ args->SetInteger(kOldHeight, old_size.height());
+ args->SetInteger(kNewWidth, new_size.width());
+ args->SetInteger(kNewHeight, new_size.height());
+ DispatchEventToGuestProxy(new GuestViewEvent(kEventResize, args.Pass()));
}
gfx::Size GuestViewBase::GetDefaultSize() const {
@@ -260,7 +258,7 @@ gfx::Size GuestViewBase::GetDefaultSize() const {
->GetRenderWidgetHostView()
->GetVisibleViewportSize();
} else {
- return gfx::Size(guestview::kDefaultWidth, guestview::kDefaultHeight);
+ return gfx::Size(kDefaultWidth, kDefaultHeight);
}
}
@@ -405,7 +403,7 @@ void GuestViewBase::DidDetach() {
StopTrackingEmbedderZoomLevel();
owner_web_contents()->Send(new GuestViewMsg_GuestDetached(
element_instance_id_));
- element_instance_id_ = guestview::kInstanceIDNone;
+ element_instance_id_ = kInstanceIDNone;
}
WebContents* GuestViewBase::GetOwnerWebContents() const {
@@ -460,8 +458,7 @@ void GuestViewBase::Destroy() {
void GuestViewBase::SetAttachParams(const base::DictionaryValue& params) {
attach_params_.reset(params.DeepCopy());
- attach_params_->GetInteger(guestview::kParameterInstanceId,
- &view_instance_id_);
+ attach_params_->GetInteger(kParameterInstanceId, &view_instance_id_);
}
void GuestViewBase::SetOpener(GuestViewBase* guest) {
@@ -738,22 +735,22 @@ double GuestViewBase::GetEmbedderZoomFactor() const {
void GuestViewBase::SetUpSizing(const base::DictionaryValue& params) {
// Read the autosize parameters passed in from the embedder.
bool auto_size_enabled = auto_size_enabled_;
- params.GetBoolean(guestview::kAttributeAutoSize, &auto_size_enabled);
+ params.GetBoolean(kAttributeAutoSize, &auto_size_enabled);
int max_height = max_auto_size_.height();
int max_width = max_auto_size_.width();
- params.GetInteger(guestview::kAttributeMaxHeight, &max_height);
- params.GetInteger(guestview::kAttributeMaxWidth, &max_width);
+ params.GetInteger(kAttributeMaxHeight, &max_height);
+ params.GetInteger(kAttributeMaxWidth, &max_width);
int min_height = min_auto_size_.height();
int min_width = min_auto_size_.width();
- params.GetInteger(guestview::kAttributeMinHeight, &min_height);
- params.GetInteger(guestview::kAttributeMinWidth, &min_width);
+ params.GetInteger(kAttributeMinHeight, &min_height);
+ params.GetInteger(kAttributeMinWidth, &min_width);
double element_height = 0.0;
double element_width = 0.0;
- params.GetDouble(guestview::kElementHeight, &element_height);
- params.GetDouble(guestview::kElementWidth, &element_width);
+ params.GetDouble(kElementHeight, &element_height);
+ params.GetDouble(kElementWidth, &element_width);
// Set the normal size to the element size so that the guestview will fit
// the element initially if autosize is disabled.
@@ -762,7 +759,7 @@ void GuestViewBase::SetUpSizing(const base::DictionaryValue& params) {
// If the element size was provided in logical units (versus physical), then
// it will be converted to physical units.
bool element_size_is_logical = false;
- params.GetBoolean(guestview::kElementSizeIsLogical, &element_size_is_logical);
+ params.GetBoolean(kElementSizeIsLogical, &element_size_is_logical);
if (element_size_is_logical) {
// Convert the element size from logical pixels to physical pixels.
normal_height = LogicalPixelsToPhysicalPixels(element_height);
@@ -821,4 +818,4 @@ void GuestViewBase::StopTrackingEmbedderZoomLevel() {
embedder_zoom_controller->RemoveObserver(this);
}
-} // namespace extensions
+} // namespace guest_view
diff --git a/extensions/browser/guest_view/guest_view_base.h b/components/guest_view/browser/guest_view_base.h
index 4506545..74fb59c 100644
--- a/extensions/browser/guest_view/guest_view_base.h
+++ b/components/guest_view/browser/guest_view_base.h
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
-#define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
+#ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_
+#define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_
#include <queue>
#include "base/memory/weak_ptr.h"
#include "base/values.h"
+#include "components/guest_view/common/guest_view_constants.h"
#include "components/ui/zoom/zoom_observer.h"
#include "content/public/browser/browser_plugin_guest_delegate.h"
#include "content/public/browser/guest_host.h"
@@ -16,11 +17,10 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
-#include "extensions/common/guest_view/guest_view_constants.h"
struct RendererContentSettingRules;
-namespace extensions {
+namespace guest_view {
class GuestViewEvent;
@@ -229,7 +229,7 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
// Returns whether this guest has an associated embedder.
bool attached() const {
- return element_instance_id_ != guestview::kInstanceIDNone;
+ return element_instance_id_ != kInstanceIDNone;
}
// Returns the instance ID of the <*view> element.
@@ -453,6 +453,6 @@ class GuestViewBase : public content::BrowserPluginGuestDelegate,
DISALLOW_COPY_AND_ASSIGN(GuestViewBase);
};
-} // namespace extensions
+} // namespace guest_view
-#endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_
+#endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_BASE_H_
diff --git a/extensions/browser/guest_view/guest_view_event.cc b/components/guest_view/browser/guest_view_event.cc
index 00b0af3..a88d62f 100644
--- a/extensions/browser/guest_view/guest_view_event.cc
+++ b/components/guest_view/browser/guest_view_event.cc
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/browser/guest_view/guest_view_event.h"
+#include "components/guest_view/browser/guest_view_event.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
+#include "components/guest_view/browser/guest_view_base.h"
+#include "components/guest_view/browser/guest_view_manager.h"
-namespace extensions {
+namespace guest_view {
GuestViewEvent::GuestViewEvent(const std::string& name,
scoped_ptr<base::DictionaryValue> args)
@@ -25,4 +25,4 @@ void GuestViewEvent::Dispatch(GuestViewBase* guest, int instance_id) {
delete this;
}
-} // namespace extensions
+} // namespace guest_view
diff --git a/extensions/browser/guest_view/guest_view_event.h b/components/guest_view/browser/guest_view_event.h
index c9c8cb8..7f51d46 100644
--- a/extensions/browser/guest_view/guest_view_event.h
+++ b/components/guest_view/browser/guest_view_event.h
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_EVENT_H_
-#define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_EVENT_H_
+#ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_EVENT_H_
+#define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_EVENT_H_
#include <string>
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
-namespace extensions {
+namespace guest_view {
class GuestViewBase;
@@ -36,6 +36,6 @@ private:
DISALLOW_COPY_AND_ASSIGN(GuestViewEvent);
};
-} // namespace extensions
+} // namespace guest_view
-#endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_EVENT_H_
+#endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_EVENT_H_
diff --git a/extensions/browser/guest_view/guest_view_manager.cc b/components/guest_view/browser/guest_view_manager.cc
index 0d6b28b..04cc220 100644
--- a/extensions/browser/guest_view/guest_view_manager.cc
+++ b/components/guest_view/browser/guest_view_manager.cc
@@ -2,9 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/browser/guest_view/guest_view_manager.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "base/macros.h"
#include "base/strings/stringprintf.h"
+#include "components/guest_view/browser/guest_view_base.h"
+#include "components/guest_view/browser/guest_view_manager_delegate.h"
+#include "components/guest_view/browser/guest_view_manager_factory.h"
+#include "components/guest_view/common/guest_view_constants.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
@@ -14,19 +19,13 @@
#include "content/public/common/child_process_host.h"
#include "content/public/common/result_codes.h"
#include "content/public/common/url_constants.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
-#include "extensions/browser/guest_view/guest_view_manager_delegate.h"
-#include "extensions/browser/guest_view/guest_view_manager_factory.h"
-#include "extensions/common/guest_view/guest_view_constants.h"
-#include "net/base/escape.h"
#include "url/gurl.h"
using content::BrowserContext;
using content::SiteInstance;
using content::WebContents;
-using guestview::GuestViewManagerDelegate;
-namespace extensions {
+namespace guest_view {
// static
GuestViewManagerFactory* GuestViewManager::factory_ = nullptr;
@@ -54,7 +53,7 @@ GuestViewManager* GuestViewManager::CreateWithDelegate(
} else {
guest_manager = new GuestViewManager(context, delegate.Pass());
}
- context->SetUserData(guestview::kGuestViewManagerKeyName, guest_manager);
+ context->SetUserData(kGuestViewManagerKeyName, guest_manager);
}
return guest_manager;
}
@@ -63,7 +62,7 @@ GuestViewManager* GuestViewManager::CreateWithDelegate(
GuestViewManager* GuestViewManager::FromBrowserContext(
BrowserContext* context) {
return static_cast<GuestViewManager*>(context->GetUserData(
- guestview::kGuestViewManagerKeyName));
+ kGuestViewManagerKeyName));
}
content::WebContents* GuestViewManager::GetGuestByInstanceIDSafely(
@@ -158,7 +157,7 @@ content::WebContents* GuestViewManager::GetGuestByInstanceID(
int element_instance_id) {
int guest_instance_id = GetGuestInstanceIDForElementID(owner_process_id,
element_instance_id);
- if (guest_instance_id == guestview::kInstanceIDNone)
+ if (guest_instance_id == kInstanceIDNone)
return nullptr;
return GetGuestByInstanceID(guest_instance_id);
@@ -169,7 +168,7 @@ int GuestViewManager::GetGuestInstanceIDForElementID(int owner_process_id,
auto iter = instance_id_map_.find(
ElementInstanceKey(owner_process_id, element_instance_id));
if (iter == instance_id_map_.end())
- return guestview::kInstanceIDNone;
+ return kInstanceIDNone;
return iter->second;
}
@@ -273,6 +272,8 @@ void GuestViewManager::DispatchEvent(const std::string& event_name,
scoped_ptr<base::DictionaryValue> args,
GuestViewBase* guest,
int instance_id) {
+ // TODO(fsamuel): GuestViewManager should probably do something more useful
+ // here like log an error if the event could not be dispatched.
delegate_->DispatchEvent(event_name, args.Pass(), guest, instance_id);
}
@@ -322,7 +323,7 @@ bool GuestViewManager::CanEmbedderAccessInstanceID(
int guest_instance_id) {
// The embedder is trying to access a guest with a negative or zero
// instance ID.
- if (guest_instance_id <= guestview::kInstanceIDNone)
+ if (guest_instance_id <= kInstanceIDNone)
return false;
// The embedder is trying to access an instance ID that has not yet been
@@ -372,4 +373,4 @@ bool GuestViewManager::ElementInstanceKey::operator==(
(element_instance_id == other.element_instance_id);
}
-} // namespace extensions
+} // namespace guest_view
diff --git a/extensions/browser/guest_view/guest_view_manager.h b/components/guest_view/browser/guest_view_manager.h
index e1fb334..f51d0a6 100644
--- a/extensions/browser/guest_view/guest_view_manager.h
+++ b/components/guest_view/browser/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 EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_
-#define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_
+#ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_H_
+#define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_H_
#include <map>
@@ -22,26 +22,24 @@ class BrowserContext;
class WebContents;
} // namespace content
-namespace guestview {
-class GuestViewManagerDelegate;
-} // namespace guestview
+namespace guest_view {
-namespace extensions{
class GuestViewBase;
+class GuestViewManagerDelegate;
class GuestViewManagerFactory;
class GuestViewManager : public content::BrowserPluginGuestManager,
public base::SupportsUserData::Data {
public:
GuestViewManager(content::BrowserContext* context,
- scoped_ptr<guestview::GuestViewManagerDelegate> delegate);
+ scoped_ptr<GuestViewManagerDelegate> delegate);
~GuestViewManager() override;
// Returns the GuestViewManager associated with |context|. If one isn't
// available, then it is created and returned.
static GuestViewManager* CreateWithDelegate(
content::BrowserContext* context,
- scoped_ptr<guestview::GuestViewManagerDelegate> delegate);
+ scoped_ptr<GuestViewManagerDelegate> delegate);
// Returns the GuestViewManager associated with |context|. If one isn't
// available, then nullptr is returned.
@@ -204,11 +202,11 @@ class GuestViewManager : public content::BrowserPluginGuestManager,
content::BrowserContext* context_;
- scoped_ptr<guestview::GuestViewManagerDelegate> delegate_;
+ scoped_ptr<GuestViewManagerDelegate> delegate_;
DISALLOW_COPY_AND_ASSIGN(GuestViewManager);
};
-} // namespace extensions
+} // namespace guest_view
-#endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_H_
+#endif // COMPONETS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_H_
diff --git a/components/guest_view/browser/guest_view_manager_delegate.cc b/components/guest_view/browser/guest_view_manager_delegate.cc
new file mode 100644
index 0000000..244c516
--- /dev/null
+++ b/components/guest_view/browser/guest_view_manager_delegate.cc
@@ -0,0 +1,23 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/guest_view/browser/guest_view_manager_delegate.h"
+
+namespace guest_view {
+
+GuestViewManagerDelegate::GuestViewManagerDelegate() {
+}
+
+GuestViewManagerDelegate::~GuestViewManagerDelegate() {
+}
+
+bool GuestViewManagerDelegate::IsGuestAvailableToContext(GuestViewBase* guest) {
+ return false;
+}
+
+bool GuestViewManagerDelegate::IsOwnedByExtension(GuestViewBase* guest) {
+ return false;
+}
+
+} // namespace guest
diff --git a/extensions/browser/guest_view/guest_view_manager_delegate.h b/components/guest_view/browser/guest_view_manager_delegate.h
index f6e1795..a46c278d 100644
--- a/extensions/browser/guest_view/guest_view_manager_delegate.h
+++ b/components/guest_view/browser/guest_view_manager_delegate.h
@@ -2,22 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_DELEGATE_H_
-#define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_DELEGATE_H_
+#ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_DELEGATE_H_
+#define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_DELEGATE_H_
#include <string>
#include "base/memory/scoped_ptr.h"
+#include "base/values.h"
namespace base {
class DictionaryValue;
} // namespace base
-namespace extensions {
-class GuestViewBase;
-} // namespace extensions
+namespace guest_view {
-namespace guestview {
+class GuestViewBase;
// A GuestViewManagerDelegate interface allows GuestViewManager to delegate
// responsibilities to other modules in Chromium. Different builds of Chromium
@@ -27,27 +26,28 @@ namespace guestview {
// return false.
class GuestViewManagerDelegate {
public:
- virtual ~GuestViewManagerDelegate() {}
+ GuestViewManagerDelegate();
+ virtual ~GuestViewManagerDelegate();
// Dispatches the event with |name| with the provided |args| to the embedder
// of the given |guest| with |instance_id| for routing.
virtual void DispatchEvent(const std::string& event_name,
scoped_ptr<base::DictionaryValue> args,
- extensions::GuestViewBase* guest,
- int instance_id) = 0;
+ GuestViewBase* guest,
+ int instance_id) {}
// Indicates whether the |guest| can be used within the context of where it
// was created.
- virtual bool IsGuestAvailableToContext(extensions::GuestViewBase* guest) = 0;
+ virtual bool IsGuestAvailableToContext(GuestViewBase* guest);
// Indicates whether the |guest| is owned by an extension or Chrome App.
- virtual bool IsOwnedByExtension(extensions::GuestViewBase* guest) = 0;
+ virtual bool IsOwnedByExtension(GuestViewBase* guest);
// Registers additional GuestView types the delegator (GuestViewManger) can
// create.
- virtual void RegisterAdditionalGuestViewTypes() = 0;
+ virtual void RegisterAdditionalGuestViewTypes() {}
};
-} // namespace guestview
+} // namespace guest_view
-#endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_DELEGATE_H_
+#endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_DELEGATE_H_
diff --git a/extensions/browser/guest_view/guest_view_manager_factory.h b/components/guest_view/browser/guest_view_manager_factory.h
index 695731c..0d127a3 100644
--- a/extensions/browser/guest_view/guest_view_manager_factory.h
+++ b/components/guest_view/browser/guest_view_manager_factory.h
@@ -2,32 +2,29 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_FACTORY_H_
-#define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_FACTORY_H_
+#ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_FACTORY_H_
+#define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_FACTORY_H_
namespace content {
class BrowserContext;
}
-namespace guestview {
-class GuestViewManagerDelegate;
-} // namespace guestview
-
-namespace extensions {
+namespace guest_view {
class GuestViewManager;
+class GuestViewManagerDelegate;
class GuestViewManagerFactory {
public:
virtual GuestViewManager* CreateGuestViewManager(
content::BrowserContext* context,
- scoped_ptr<guestview::GuestViewManagerDelegate> delegate) = 0;
+ scoped_ptr<GuestViewManagerDelegate> delegate) = 0;
protected:
virtual ~GuestViewManagerFactory() {}
};
-} // namespace extensions
+} // namespace guest_view
-#endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MANAGER_FACTORY_H_
+#endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MANAGER_FACTORY_H_
diff --git a/extensions/browser/guest_view/guest_view_manager_unittest.cc b/components/guest_view/browser/guest_view_manager_unittest.cc
index 2a380e4..1d43dbd 100644
--- a/extensions/browser/guest_view/guest_view_manager_unittest.cc
+++ b/components/guest_view/browser/guest_view_manager_unittest.cc
@@ -2,30 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/browser/guest_view/guest_view_manager.h"
-
-#include "content/public/browser/notification_service.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "components/guest_view/browser/guest_view_manager_delegate.h"
+#include "components/guest_view/browser/test_guest_view_manager.h"
#include "content/public/test/test_browser_context.h"
-#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/test_renderer_host.h"
#include "content/public/test/web_contents_tester.h"
-#include "extensions/browser/extensions_test.h"
-#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
-#include "extensions/browser/guest_view/guest_view_manager_delegate.h"
-#include "extensions/browser/guest_view/test_guest_view_manager.h"
+#include "testing/gtest/include/gtest/gtest.h"
using content::WebContents;
using content::WebContentsTester;
-using guestview::GuestViewManagerDelegate;
-namespace extensions {
+namespace guest_view {
namespace {
-class GuestViewManagerTest : public extensions::ExtensionsTest {
+class GuestViewManagerTest : public content::RenderViewHostTestHarness {
public:
- GuestViewManagerTest() :
- notification_service_(content::NotificationService::Create()) {}
+ GuestViewManagerTest() {}
~GuestViewManagerTest() override {}
scoped_ptr<WebContents> CreateWebContents() {
@@ -34,8 +28,6 @@ class GuestViewManagerTest : public extensions::ExtensionsTest {
}
private:
- scoped_ptr<content::NotificationService> notification_service_;
- content::TestBrowserThreadBundle thread_bundle_;
content::TestBrowserContext browser_context_;
DISALLOW_COPY_AND_ASSIGN(GuestViewManagerTest);
@@ -46,9 +38,9 @@ class GuestViewManagerTest : public extensions::ExtensionsTest {
TEST_F(GuestViewManagerTest, AddRemove) {
content::TestBrowserContext browser_context;
scoped_ptr<GuestViewManagerDelegate> delegate(
- new ExtensionsGuestViewManagerDelegate(&browser_context));
+ new GuestViewManagerDelegate());
scoped_ptr<TestGuestViewManager> manager(
- new extensions::TestGuestViewManager(&browser_context, delegate.Pass()));
+ new TestGuestViewManager(&browser_context, delegate.Pass()));
scoped_ptr<WebContents> web_contents1(CreateWebContents());
scoped_ptr<WebContents> web_contents2(CreateWebContents());
@@ -86,7 +78,7 @@ TEST_F(GuestViewManagerTest, AddRemove) {
EXPECT_FALSE(manager->CanUseGuestInstanceID(2));
EXPECT_FALSE(manager->CanUseGuestInstanceID(3));
- EXPECT_EQ(0, manager->GetNumRemovedInstanceIDs());
+ EXPECT_EQ(0u, manager->GetNumRemovedInstanceIDs());
}
-} // namespace extensions
+} // namespace guest_view
diff --git a/extensions/browser/guest_view/guest_view_message_filter.cc b/components/guest_view/browser/guest_view_message_filter.cc
index 26188fa..d313f53 100644
--- a/extensions/browser/guest_view/guest_view_message_filter.cc
+++ b/components/guest_view/browser/guest_view_message_filter.cc
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/browser/guest_view/guest_view_message_filter.h"
+#include "components/guest_view/browser/guest_view_message_filter.h"
+#include "components/guest_view/browser/guest_view_base.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "components/guest_view/common/guest_view_messages.h"
#include "content/public/browser/browser_thread.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"
-#include "extensions/browser/guest_view/guest_view_base.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
-#include "extensions/common/guest_view/guest_view_messages.h"
#include "ipc/ipc_message_macros.h"
using content::BrowserContext;
@@ -18,7 +18,7 @@ using content::BrowserThread;
using content::RenderFrameHost;
using content::WebContents;
-namespace extensions {
+namespace guest_view {
GuestViewMessageFilter::GuestViewMessageFilter(int render_process_id,
BrowserContext* context)
@@ -77,4 +77,4 @@ void GuestViewMessageFilter::OnAttachGuest(
params);
}
-} // namespace extensions
+} // namespace guest_view
diff --git a/extensions/browser/guest_view/guest_view_message_filter.h b/components/guest_view/browser/guest_view_message_filter.h
index c5fb487..7d2448f 100644
--- a/extensions/browser/guest_view/guest_view_message_filter.h
+++ b/components/guest_view/browser/guest_view_message_filter.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 EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MESSAGE_FILTER_H_
-#define EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MESSAGE_FILTER_H_
+#ifndef COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MESSAGE_FILTER_H_
+#define COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MESSAGE_FILTER_H_
#include <string>
@@ -24,7 +24,7 @@ namespace gfx {
class Size;
}
-namespace extensions {
+namespace guest_view {
// This class filters out incoming GuestView-specific IPC messages from the
// renderer process. It is created on the UI thread. Messages may be handled on
@@ -62,6 +62,6 @@ class GuestViewMessageFilter : public content::BrowserMessageFilter {
DISALLOW_COPY_AND_ASSIGN(GuestViewMessageFilter);
};
-} // namespace extensions
+} // namespace guest_view
-#endif // EXTENSIONS_BROWSER_GUEST_VIEW_GUEST_VIEW_MESSAGE_FILTER_H_
+#endif // COMPONENTS_GUEST_VIEW_BROWSER_GUEST_VIEW_MESSAGE_FILTER_H_
diff --git a/extensions/browser/guest_view/test_guest_view_manager.cc b/components/guest_view/browser/test_guest_view_manager.cc
index 875939e..90a1023 100644
--- a/extensions/browser/guest_view/test_guest_view_manager.cc
+++ b/components/guest_view/browser/test_guest_view_manager.cc
@@ -2,13 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/browser/guest_view/test_guest_view_manager.h"
+#include "components/guest_view/browser/test_guest_view_manager.h"
-#include "extensions/browser/guest_view/guest_view_manager_delegate.h"
+#include "base/memory/scoped_ptr.h"
+#include "components/guest_view/browser/guest_view_manager_delegate.h"
-using guestview::GuestViewManagerDelegate;
-
-namespace extensions {
+namespace guest_view {
TestGuestViewManager::TestGuestViewManager(
content::BrowserContext* context,
@@ -20,11 +19,11 @@ TestGuestViewManager::TestGuestViewManager(
TestGuestViewManager::~TestGuestViewManager() {
}
-int TestGuestViewManager::GetNumGuestsActive() const {
+size_t TestGuestViewManager::GetNumGuestsActive() const {
return guest_web_contents_by_instance_id_.size();
}
-int TestGuestViewManager::GetNumRemovedInstanceIDs() const {
+size_t TestGuestViewManager::GetNumRemovedInstanceIDs() const {
return removed_instance_ids_.size();
}
@@ -89,7 +88,7 @@ TestGuestViewManagerFactory::~TestGuestViewManagerFactory() {
GuestViewManager* TestGuestViewManagerFactory::CreateGuestViewManager(
content::BrowserContext* context,
- scoped_ptr<guestview::GuestViewManagerDelegate> delegate) {
+ scoped_ptr<GuestViewManagerDelegate> delegate) {
if (!test_guest_view_manager_) {
test_guest_view_manager_ =
new TestGuestViewManager(context, delegate.Pass());
@@ -97,4 +96,4 @@ GuestViewManager* TestGuestViewManagerFactory::CreateGuestViewManager(
return test_guest_view_manager_;
}
-} // namespace extensions
+} // namespace guest_view
diff --git a/extensions/browser/guest_view/test_guest_view_manager.h b/components/guest_view/browser/test_guest_view_manager.h
index d819325..cbf942f 100644
--- a/extensions/browser/guest_view/test_guest_view_manager.h
+++ b/components/guest_view/browser/test_guest_view_manager.h
@@ -2,22 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_TEST_GUEST_VIEW_MANAGER_H_
-#define EXTENSIONS_BROWSER_GUEST_VIEW_TEST_GUEST_VIEW_MANAGER_H_
+#ifndef COMPONENTS_GUEST_VIEW_BROWSER_TEST_GUEST_VIEW_MANAGER_H_
+#define COMPONENTS_GUEST_VIEW_BROWSER_TEST_GUEST_VIEW_MANAGER_H_
#include "base/memory/linked_ptr.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "components/guest_view/browser/guest_view_manager_factory.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"
-namespace extensions {
+namespace guest_view {
class TestGuestViewManager : public GuestViewManager {
public:
TestGuestViewManager(
content::BrowserContext* context,
- scoped_ptr<guestview::GuestViewManagerDelegate> delegate);
+ scoped_ptr<GuestViewManagerDelegate> delegate);
~TestGuestViewManager() override;
void WaitForAllGuestsDeleted();
@@ -27,10 +27,10 @@ class TestGuestViewManager : public GuestViewManager {
// Returns the number of guests currently still alive at the time of calling
// this method.
- int GetNumGuestsActive() const;
+ size_t GetNumGuestsActive() const;
// Returns the size of the set of removed instance IDs.
- int GetNumRemovedInstanceIDs() const;
+ size_t GetNumRemovedInstanceIDs() const;
// Returns the number of guests that have been created since the creation of
// this GuestViewManager.
@@ -69,7 +69,7 @@ class TestGuestViewManagerFactory : public GuestViewManagerFactory {
GuestViewManager* CreateGuestViewManager(
content::BrowserContext* context,
- scoped_ptr<guestview::GuestViewManagerDelegate> delegate) override;
+ scoped_ptr<GuestViewManagerDelegate> delegate) override;
private:
TestGuestViewManager* test_guest_view_manager_;
@@ -77,6 +77,6 @@ class TestGuestViewManagerFactory : public GuestViewManagerFactory {
DISALLOW_COPY_AND_ASSIGN(TestGuestViewManagerFactory);
};
-} // namespace extensions
+} // namespace guest_view
-#endif // EXTENSIONS_BROWSER_GUEST_VIEW_TEST_GUEST_VIEW_MANAGER_H_
+#endif // COMPONENTS_GUEST_VIEW_BROWSER_TEST_GUEST_VIEW_MANAGER_H_
diff --git a/components/guest_view/common/DEPS b/components/guest_view/common/DEPS
new file mode 100644
index 0000000..b0e64bf
--- /dev/null
+++ b/components/guest_view/common/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+ipc"
+]
diff --git a/components/guest_view/common/OWNERS b/components/guest_view/common/OWNERS
new file mode 100644
index 0000000..bba0da4
--- /dev/null
+++ b/components/guest_view/common/OWNERS
@@ -0,0 +1,15 @@
+fsamuel@chromium.org
+lazyboy@chromium.org
+
+# For security review of IPC message files.
+per-file *_messages*.h=set noparent
+per-file *_messages*.h=dcheng@chromium.org
+per-file *_messages*.h=inferno@chromium.org
+per-file *_messages*.h=jln@chromium.org
+per-file *_messages*.h=jschuh@chromium.org
+per-file *_messages*.h=kenrb@chromium.org
+per-file *_messages*.h=mkwst@chromium.org
+per-file *_messages*.h=nasko@chromium.org
+per-file *_messages*.h=palmer@chromium.org
+per-file *_messages*.h=tsepez@chromium.org
+per-file *_messages*.h=wfh@chromium.org
diff --git a/extensions/common/guest_view/guest_view_constants.cc b/components/guest_view/common/guest_view_constants.cc
index f5acd35..e68c3b8 100644
--- a/extensions/common/guest_view/guest_view_constants.cc
+++ b/components/guest_view/common/guest_view_constants.cc
@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "extensions/common/guest_view/guest_view_constants.h"
+#include "components/guest_view/common/guest_view_constants.h"
-namespace guestview {
+namespace guest_view {
// Sizing attributes/parameters.
const char kAttributeAutoSize[] = "autosize";
diff --git a/extensions/common/guest_view/guest_view_constants.h b/components/guest_view/common/guest_view_constants.h
index 8fe8ff1..ef9066e 100644
--- a/extensions/common/guest_view/guest_view_constants.h
+++ b/components/guest_view/common/guest_view_constants.h
@@ -4,10 +4,10 @@
// Constants used for the WebView API.
-#ifndef EXTENSIONS_COMMON_GUEST_VIEW_GUEST_VIEW_CONSTANTS_H_
-#define EXTENSIONS_COMMON_GUEST_VIEW_GUEST_VIEW_CONSTANTS_H_
+#ifndef COMPONENTS_GUEST_VIEW_COMMON_GUEST_VIEW_CONSTANTS_H_
+#define COMPONENTS_GUEST_VIEW_COMMON_GUEST_VIEW_CONSTANTS_H_
-namespace guestview {
+namespace guest_view {
// Sizing attributes/parameters.
extern const char kAttributeAutoSize[];
@@ -45,6 +45,6 @@ extern const int kInstanceIDNone;
extern const int kDefaultWidth;
extern const int kDefaultHeight;
-} // namespace guestview
+} // namespace guest_view
-#endif // EXTENSIONS_COMMON_GUEST_VIEW_GUEST_VIEW_CONSTANTS_H_
+#endif // COMPONENTS_GUEST_VIEW_COMMON_GUEST_VIEW_CONSTANTS_H_
diff --git a/components/guest_view/common/guest_view_message_generator.cc b/components/guest_view/common/guest_view_message_generator.cc
new file mode 100644
index 0000000..6a0bca1
--- /dev/null
+++ b/components/guest_view/common/guest_view_message_generator.cc
@@ -0,0 +1,33 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Get basic type definitions.
+#define IPC_MESSAGE_IMPL
+#include "components/guest_view/common/guest_view_message_generator.h"
+
+// Generate constructors.
+#include "ipc/struct_constructor_macros.h"
+#include "components/guest_view/common/guest_view_message_generator.h"
+
+// Generate destructors.
+#include "ipc/struct_destructor_macros.h"
+#include "components/guest_view/common/guest_view_message_generator.h"
+
+// Generate param traits write methods.
+#include "ipc/param_traits_write_macros.h"
+namespace IPC {
+#include "components/guest_view/common/guest_view_message_generator.h"
+} // namespace IPC
+
+// Generate param traits read methods.
+#include "ipc/param_traits_read_macros.h"
+namespace IPC {
+#include "components/guest_view/common/guest_view_message_generator.h"
+} // namespace IPC
+
+// Generate param traits log methods.
+#include "ipc/param_traits_log_macros.h"
+namespace IPC {
+#include "components/guest_view/common/guest_view_message_generator.h"
+} // namespace IPC
diff --git a/components/guest_view/common/guest_view_message_generator.h b/components/guest_view/common/guest_view_message_generator.h
new file mode 100644
index 0000000..0e569e2
--- /dev/null
+++ b/components/guest_view/common/guest_view_message_generator.h
@@ -0,0 +1,7 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Multiply-included file, no traditional include guard.
+
+#include "components/guest_view/common/guest_view_messages.h"
diff --git a/extensions/common/guest_view/guest_view_messages.h b/components/guest_view/common/guest_view_messages.h
index 9772b6f..9772b6f 100644
--- a/extensions/common/guest_view/guest_view_messages.h
+++ b/components/guest_view/common/guest_view_messages.h
diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn
index 60d0ed4..547d956 100644
--- a/extensions/BUILD.gn
+++ b/extensions/BUILD.gn
@@ -78,6 +78,7 @@ source_set("test_support") {
":extensions_resources",
"//base",
"//base:prefs_test_support",
+ "//components/guest_view:test_support",
"//content/public/common",
"//content/test:test_support",
"//extensions/browser",
diff --git a/extensions/DEPS b/extensions/DEPS
index 285b7d3..8f8f7f2 100644
--- a/extensions/DEPS
+++ b/extensions/DEPS
@@ -2,6 +2,7 @@ include_rules = [
# Do not add Chrome dependencies. Much work went into removing them.
"+components/browsing_data",
"+components/crx_file",
+ "+components/guest_view",
"+components/url_matcher",
"-content",
"+content/grit/content_resources.h",
diff --git a/extensions/browser/DEPS b/extensions/browser/DEPS
index 2eb1155..5bc7e92 100644
--- a/extensions/browser/DEPS
+++ b/extensions/browser/DEPS
@@ -1,5 +1,6 @@
include_rules = [
"+chromeos",
+ "+components/guest_view",
"+components/keyed_service",
"+components/pref_registry",
"+components/sessions",
diff --git a/extensions/browser/api/guest_view/guest_view_internal_api.cc b/extensions/browser/api/guest_view/guest_view_internal_api.cc
index aea9c8e..ac3c85b 100644
--- a/extensions/browser/api/guest_view/guest_view_internal_api.cc
+++ b/extensions/browser/api/guest_view/guest_view_internal_api.cc
@@ -4,16 +4,18 @@
#include "extensions/browser/api/guest_view/guest_view_internal_api.h"
+#include "components/guest_view/browser/guest_view_base.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "components/guest_view/common/guest_view_constants.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "extensions/common/api/guest_view_internal.h"
-#include "extensions/common/guest_view/guest_view_constants.h"
#include "extensions/common/permissions/permissions_data.h"
-using guestview::GuestViewManagerDelegate;
+using guest_view::GuestViewBase;
+using guest_view::GuestViewManager;
+using guest_view::GuestViewManagerDelegate;
namespace guest_view_internal = extensions::core_api::guest_view_internal;
@@ -53,7 +55,7 @@ bool GuestViewInternalCreateGuestFunction::RunAsync() {
// Add flag to |create_params| to indicate that the element size is specified
// in logical units.
- create_params->SetBoolean(guestview::kElementSizeIsLogical, true);
+ create_params->SetBoolean(guest_view::kElementSizeIsLogical, true);
guest_view_manager->CreateGuest(view_type,
sender_web_contents,
@@ -72,8 +74,8 @@ void GuestViewInternalCreateGuestFunction::CreateGuestCallback(
content_window_id = guest->proxy_routing_id();
}
scoped_ptr<base::DictionaryValue> return_params(new base::DictionaryValue());
- return_params->SetInteger(guestview::kID, guest_instance_id);
- return_params->SetInteger(guestview::kContentWindowID, content_window_id);
+ return_params->SetInteger(guest_view::kID, guest_instance_id);
+ return_params->SetInteger(guest_view::kContentWindowID, content_window_id);
SetResult(return_params.release());
SendResponse(true);
}
@@ -114,7 +116,7 @@ bool GuestViewInternalSetSizeFunction::RunAsync() {
if (!guest)
return false;
- SetSizeParams set_size_params;
+ guest_view::SetSizeParams set_size_params;
if (params->params.enable_auto_size) {
set_size_params.enable_auto_size.reset(
params->params.enable_auto_size.release());
diff --git a/extensions/browser/guest_view/app_view/app_view_apitest.cc b/extensions/browser/guest_view/app_view/app_view_apitest.cc
index b9fc7c9..ab63231 100644
--- a/extensions/browser/guest_view/app_view/app_view_apitest.cc
+++ b/extensions/browser/guest_view/app_view/app_view_apitest.cc
@@ -4,14 +4,14 @@
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "components/guest_view/browser/guest_view_manager_factory.h"
+#include "components/guest_view/browser/test_guest_view_manager.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/app_window/app_window.h"
#include "extensions/browser/app_window/app_window_registry.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
-#include "extensions/browser/guest_view/guest_view_manager_factory.h"
-#include "extensions/browser/guest_view/test_guest_view_manager.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_paths.h"
#include "extensions/shell/browser/shell_app_delegate.h"
@@ -24,6 +24,10 @@
#include "extensions/test/extension_test_message_listener.h"
#include "net/base/filename_util.h"
+using guest_view::GuestViewManager;
+using guest_view::TestGuestViewManager;
+using guest_view::TestGuestViewManagerFactory;
+
namespace {
class MockShellAppDelegate : public extensions::ShellAppDelegate {
diff --git a/extensions/browser/guest_view/app_view/app_view_guest.cc b/extensions/browser/guest_view/app_view/app_view_guest.cc
index 386ab0d..65a5295 100644
--- a/extensions/browser/guest_view/app_view/app_view_guest.cc
+++ b/extensions/browser/guest_view/app_view/app_view_guest.cc
@@ -5,6 +5,7 @@
#include "extensions/browser/guest_view/app_view/app_view_guest.h"
#include "base/command_line.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/common/renderer_preferences.h"
#include "extensions/browser/api/app_runtime/app_runtime_api.h"
@@ -15,7 +16,6 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/guest_view/app_view/app_view_constants.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "extensions/browser/lazy_background_task_queue.h"
#include "extensions/browser/process_manager.h"
#include "extensions/browser/view_type_utils.h"
@@ -29,6 +29,7 @@ namespace app_runtime = extensions::core_api::app_runtime;
using content::RenderFrameHost;
using content::WebContents;
using extensions::ExtensionHost;
+using guest_view::GuestViewBase;
namespace extensions {
diff --git a/extensions/browser/guest_view/app_view/app_view_guest.h b/extensions/browser/guest_view/app_view/app_view_guest.h
index 59ea212..4b05d1a 100644
--- a/extensions/browser/guest_view/app_view/app_view_guest.h
+++ b/extensions/browser/guest_view/app_view/app_view_guest.h
@@ -6,9 +6,9 @@
#define EXTENSIONS_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_
#include "base/id_map.h"
+#include "components/guest_view/browser/guest_view.h"
#include "extensions/browser/extension_function_dispatcher.h"
#include "extensions/browser/guest_view/app_view/app_view_guest_delegate.h"
-#include "extensions/browser/guest_view/guest_view.h"
namespace extensions {
class Extension;
@@ -18,7 +18,7 @@ class ExtensionHost;
// AppViewGuest is created on attachment. That is, when a guest WebContents is
// associated with a particular embedder WebContents. This happens on calls to
// the connect API.
-class AppViewGuest : public GuestView<AppViewGuest>,
+class AppViewGuest : public guest_view::GuestView<AppViewGuest>,
public ExtensionFunctionDispatcher::Delegate {
public:
static const char Type[];
diff --git a/extensions/browser/guest_view/extension_options/extension_options_guest.cc b/extensions/browser/guest_view/extension_options/extension_options_guest.cc
index 9a60a51..c882315 100644
--- a/extensions/browser/guest_view/extension_options/extension_options_guest.cc
+++ b/extensions/browser/guest_view/extension_options/extension_options_guest.cc
@@ -6,6 +6,8 @@
#include "base/values.h"
#include "components/crx_file/id_util.h"
+#include "components/guest_view/browser/guest_view_event.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/site_instance.h"
@@ -18,8 +20,6 @@
#include "extensions/browser/extension_web_contents_observer.h"
#include "extensions/browser/guest_view/extension_options/extension_options_constants.h"
#include "extensions/browser/guest_view/extension_options/extension_options_guest_delegate.h"
-#include "extensions/browser/guest_view/guest_view_event.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "extensions/common/api/extension_options_internal.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
@@ -30,6 +30,8 @@
#include "ipc/ipc_message_macros.h"
using content::WebContents;
+using guest_view::GuestViewBase;
+using guest_view::GuestViewEvent;
using namespace extensions::core_api;
namespace extensions {
@@ -49,7 +51,7 @@ ExtensionOptionsGuest::~ExtensionOptionsGuest() {
}
// static
-extensions::GuestViewBase* ExtensionOptionsGuest::Create(
+GuestViewBase* ExtensionOptionsGuest::Create(
content::WebContents* owner_web_contents) {
return new ExtensionOptionsGuest(owner_web_contents);
}
diff --git a/extensions/browser/guest_view/extension_options/extension_options_guest.h b/extensions/browser/guest_view/extension_options/extension_options_guest.h
index a40af6e..b62d81a 100644
--- a/extensions/browser/guest_view/extension_options/extension_options_guest.h
+++ b/extensions/browser/guest_view/extension_options/extension_options_guest.h
@@ -6,9 +6,9 @@
#define EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_OPTIONS_EXTENSION_OPTIONS_GUEST_H_
#include "base/macros.h"
+#include "components/guest_view/browser/guest_view.h"
#include "extensions/browser/extension_function_dispatcher.h"
#include "extensions/browser/guest_view/extension_options/extension_options_guest_delegate.h"
-#include "extensions/browser/guest_view/guest_view.h"
#include "url/gurl.h"
namespace content {
@@ -18,11 +18,11 @@ class BrowserContext;
namespace extensions {
class ExtensionOptionsGuest
- : public extensions::GuestView<ExtensionOptionsGuest>,
+ : public guest_view::GuestView<ExtensionOptionsGuest>,
public extensions::ExtensionFunctionDispatcher::Delegate {
public:
static const char Type[];
- static extensions::GuestViewBase* Create(
+ static guest_view::GuestViewBase* Create(
content::WebContents* owner_web_contents);
// GuestViewBase implementation.
diff --git a/extensions/browser/guest_view/extension_view/extension_view_guest.cc b/extensions/browser/guest_view/extension_view/extension_view_guest.cc
index 79922ee..b9f73f4 100644
--- a/extensions/browser/guest_view/extension_view/extension_view_guest.cc
+++ b/extensions/browser/guest_view/extension_view/extension_view_guest.cc
@@ -6,17 +6,19 @@
#include "base/strings/string_util.h"
#include "components/crx_file/id_util.h"
+#include "components/guest_view/browser/guest_view_event.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/result_codes.h"
#include "extensions/browser/api/extensions_api_client.h"
#include "extensions/browser/bad_message.h"
#include "extensions/browser/guest_view/extension_view/extension_view_constants.h"
-#include "extensions/browser/guest_view/guest_view_event.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension_messages.h"
#include "extensions/strings/grit/extensions_strings.h"
using content::WebContents;
+using guest_view::GuestViewBase;
+using guest_view::GuestViewEvent;
using namespace extensions::core_api;
namespace extensions {
@@ -36,7 +38,7 @@ ExtensionViewGuest::~ExtensionViewGuest() {
}
// static
-extensions::GuestViewBase* ExtensionViewGuest::Create(
+GuestViewBase* ExtensionViewGuest::Create(
content::WebContents* owner_web_contents) {
return new ExtensionViewGuest(owner_web_contents);
}
@@ -141,7 +143,7 @@ void ExtensionViewGuest::DidCommitProvisionalLoadForFrame(
ReplaceFirstSubstringAfterOffset(&relative_url, 0, prefix, "");
scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
- args->SetString(guestview::kUrl, relative_url);
+ args->SetString(guest_view::kUrl, relative_url);
DispatchEventToView(
new GuestViewEvent(extensionview::kEventLoadCommit, args.Pass()));
}
diff --git a/extensions/browser/guest_view/extension_view/extension_view_guest.h b/extensions/browser/guest_view/extension_view/extension_view_guest.h
index 055ee22..8a3fd7d 100644
--- a/extensions/browser/guest_view/extension_view/extension_view_guest.h
+++ b/extensions/browser/guest_view/extension_view/extension_view_guest.h
@@ -6,9 +6,9 @@
#define EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_
#include "base/macros.h"
+#include "components/guest_view/browser/guest_view.h"
#include "extensions/browser/extension_function_dispatcher.h"
#include "extensions/browser/guest_view/extension_view/extension_view_guest_delegate.h"
-#include "extensions/browser/guest_view/guest_view.h"
#include "url/gurl.h"
namespace content {
@@ -18,11 +18,11 @@ class BrowserContext;
namespace extensions {
class ExtensionViewGuest
- : public extensions::GuestView<ExtensionViewGuest>,
- public extensions::ExtensionFunctionDispatcher::Delegate {
+ : public guest_view::GuestView<ExtensionViewGuest>,
+ public ExtensionFunctionDispatcher::Delegate {
public:
static const char Type[];
- static extensions::GuestViewBase* Create(
+ static guest_view::GuestViewBase* Create(
content::WebContents* owner_web_contents);
// Request navigating the guest to the provided |src| URL.
diff --git a/extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc b/extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc
index 975d962..854c6b2 100644
--- a/extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc
+++ b/extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc
@@ -4,14 +4,14 @@
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
+#include "components/guest_view/browser/guest_view_base.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_process_host.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/guest_view/app_view/app_view_guest.h"
#include "extensions/browser/guest_view/extension_options/extension_options_guest.h"
#include "extensions/browser/guest_view/extension_view/extension_view_guest.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
#include "extensions/browser/guest_view/surface_worker/surface_worker_guest.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
@@ -20,6 +20,9 @@
#include "extensions/common/features/feature.h"
#include "extensions/common/features/feature_provider.h"
+using guest_view::GuestViewBase;
+using guest_view::GuestViewManager;
+
namespace extensions {
ExtensionsGuestViewManagerDelegate::ExtensionsGuestViewManagerDelegate(
@@ -51,7 +54,7 @@ void ExtensionsGuestViewManagerDelegate::DispatchEvent(
}
bool ExtensionsGuestViewManagerDelegate::IsGuestAvailableToContext(
- extensions::GuestViewBase* guest) {
+ GuestViewBase* guest) {
const Feature* feature =
FeatureProvider::GetAPIFeature(guest->GetAPINamespace());
CHECK(feature);
@@ -74,14 +77,13 @@ bool ExtensionsGuestViewManagerDelegate::IsGuestAvailableToContext(
}
bool ExtensionsGuestViewManagerDelegate::IsOwnedByExtension(
- extensions::GuestViewBase* guest) {
+ GuestViewBase* guest) {
return !!ProcessManager::Get(context_)->
GetExtensionForWebContents(guest->owner_web_contents());
}
void ExtensionsGuestViewManagerDelegate::RegisterAdditionalGuestViewTypes() {
- extensions::GuestViewManager* manager =
- extensions::GuestViewManager::FromBrowserContext(context_);
+ GuestViewManager* manager = GuestViewManager::FromBrowserContext(context_);
manager->RegisterGuestViewType<AppViewGuest>();
manager->RegisterGuestViewType<ExtensionOptionsGuest>();
manager->RegisterGuestViewType<ExtensionViewGuest>();
diff --git a/extensions/browser/guest_view/extensions_guest_view_manager_delegate.h b/extensions/browser/guest_view/extensions_guest_view_manager_delegate.h
index 1b47820..8a2d649 100644
--- a/extensions/browser/guest_view/extensions_guest_view_manager_delegate.h
+++ b/extensions/browser/guest_view/extensions_guest_view_manager_delegate.h
@@ -5,23 +5,18 @@
#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_MANAGER_DELEGATE_H_
#define EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_MANAGER_DELEGATE_H_
-#include "extensions/browser/guest_view/guest_view_manager_delegate.h"
+#include "components/guest_view/browser/guest_view_manager_delegate.h"
namespace content {
class BrowserContext;
} // namespace content
namespace extensions {
-class GuestViewBase;
-class GuestViewManager;
-} // namespace extensions
-
-namespace extensions {
// ExtensionsGuestViewManagerDelegate implements GuestViewManager functionality
// specific to Chromium builds that include the extensions module.
class ExtensionsGuestViewManagerDelegate
- : public guestview::GuestViewManagerDelegate {
+ : public guest_view::GuestViewManagerDelegate {
public:
explicit ExtensionsGuestViewManagerDelegate(content::BrowserContext* context);
~ExtensionsGuestViewManagerDelegate() override;
@@ -29,10 +24,10 @@ class ExtensionsGuestViewManagerDelegate
// GuestViewManagerDelegate implementation.
void DispatchEvent(const std::string& event_name,
scoped_ptr<base::DictionaryValue> args,
- GuestViewBase* guest,
+ guest_view::GuestViewBase* guest,
int instance_id) override;
- bool IsGuestAvailableToContext(extensions::GuestViewBase* guest) override;
- bool IsOwnedByExtension(extensions::GuestViewBase* guest) override;
+ bool IsGuestAvailableToContext(guest_view::GuestViewBase* guest) override;
+ bool IsOwnedByExtension(guest_view::GuestViewBase* guest) override;
void RegisterAdditionalGuestViewTypes() override;
private:
diff --git a/extensions/browser/guest_view/extensions_guest_view_message_filter.cc b/extensions/browser/guest_view/extensions_guest_view_message_filter.cc
index 7f52840..1d6f660 100644
--- a/extensions/browser/guest_view/extensions_guest_view_message_filter.cc
+++ b/extensions/browser/guest_view/extensions_guest_view_message_filter.cc
@@ -4,13 +4,13 @@
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
+#include "components/guest_view/browser/guest_view_base.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "content/public/browser/browser_thread.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"
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_constants.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
#include "extensions/browser/guest_view/web_view/web_view_content_script_manager.h"
@@ -23,7 +23,8 @@ using content::BrowserContext;
using content::BrowserThread;
using content::RenderFrameHost;
using content::WebContents;
-using guestview::GuestViewManagerDelegate;
+using guest_view::GuestViewManager;
+using guest_view::GuestViewManagerDelegate;
namespace extensions {
@@ -119,8 +120,8 @@ void ExtensionsGuestViewMessageFilter::OnCreateMimeHandlerViewGuest(
base::DictionaryValue create_params;
create_params.SetString(mime_handler_view::kViewId, view_id);
- create_params.SetInteger(guestview::kElementWidth, element_size.width());
- create_params.SetInteger(guestview::kElementHeight, element_size.height());
+ create_params.SetInteger(guest_view::kElementWidth, element_size.width());
+ create_params.SetInteger(guest_view::kElementHeight, element_size.height());
manager->CreateGuest(MimeHandlerViewGuest::Type,
embedder_web_contents,
create_params,
@@ -143,7 +144,7 @@ void ExtensionsGuestViewMessageFilter::OnResizeGuest(
if (!mhvg)
return;
- SetSizeParams set_size_params;
+ guest_view::SetSizeParams set_size_params;
set_size_params.enable_auto_size.reset(new bool(false));
set_size_params.normal_size.reset(new gfx::Size(new_size));
mhvg->SetSize(set_size_params);
@@ -166,8 +167,8 @@ void ExtensionsGuestViewMessageFilter::MimeHandlerViewGuestCreatedCallback(
return;
base::DictionaryValue attach_params;
- attach_params.SetInteger(guestview::kElementWidth, element_size.width());
- attach_params.SetInteger(guestview::kElementHeight, element_size.height());
+ attach_params.SetInteger(guest_view::kElementWidth, element_size.width());
+ attach_params.SetInteger(guest_view::kElementHeight, element_size.height());
auto manager = GuestViewManager::FromBrowserContext(browser_context_);
CHECK(manager);
manager->AttachGuest(embedder_render_process_id,
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
index bf91ebe..61fd142 100644
--- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
+++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
@@ -5,6 +5,7 @@
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
#include "base/strings/stringprintf.h"
+#include "components/guest_view/common/guest_view_constants.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/render_process_host.h"
@@ -22,13 +23,13 @@
#include "extensions/common/constants.h"
#include "extensions/common/extension_messages.h"
#include "extensions/common/guest_view/extensions_guest_view_messages.h"
-#include "extensions/common/guest_view/guest_view_constants.h"
#include "extensions/strings/grit/extensions_strings.h"
#include "ipc/ipc_message_macros.h"
#include "net/base/url_util.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
using content::WebContents;
+using guest_view::GuestViewBase;
namespace extensions {
diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
index b9eb252..482d9de 100644
--- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
+++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
@@ -6,8 +6,8 @@
#define EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUEST_H_
#include "base/memory/weak_ptr.h"
+#include "components/guest_view/browser/guest_view.h"
#include "extensions/browser/extension_function_dispatcher.h"
-#include "extensions/browser/guest_view/guest_view.h"
namespace content {
class WebContents;
@@ -50,10 +50,11 @@ class StreamContainer {
base::WeakPtrFactory<StreamContainer> weak_factory_;
};
-class MimeHandlerViewGuest : public GuestView<MimeHandlerViewGuest>,
+class MimeHandlerViewGuest : public guest_view::GuestView<MimeHandlerViewGuest>,
public ExtensionFunctionDispatcher::Delegate {
public:
- static GuestViewBase* Create(content::WebContents* owner_web_contents);
+ static guest_view::GuestViewBase* Create(
+ content::WebContents* owner_web_contents);
static const char Type[];
diff --git a/extensions/browser/guest_view/surface_worker/surface_worker_guest.cc b/extensions/browser/guest_view/surface_worker/surface_worker_guest.cc
index 6c30d9c..07379e2 100644
--- a/extensions/browser/guest_view/surface_worker/surface_worker_guest.cc
+++ b/extensions/browser/guest_view/surface_worker/surface_worker_guest.cc
@@ -4,14 +4,16 @@
#include "extensions/browser/guest_view/surface_worker/surface_worker_guest.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "content/public/common/url_constants.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "extensions/browser/guest_view/surface_worker/surface_worker_constants.h"
#include "extensions/strings/grit/extensions_strings.h"
#include "ipc/ipc_message_macros.h"
using content::RenderFrameHost;
using content::WebContents;
+using guest_view::GuestViewBase;
+using guest_view::GuestViewManager;
namespace extensions {
diff --git a/extensions/browser/guest_view/surface_worker/surface_worker_guest.h b/extensions/browser/guest_view/surface_worker/surface_worker_guest.h
index 19072a0..e1db441cc 100644
--- a/extensions/browser/guest_view/surface_worker/surface_worker_guest.h
+++ b/extensions/browser/guest_view/surface_worker/surface_worker_guest.h
@@ -5,7 +5,7 @@
#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_SURFACE_WORKER_SURFACE_WORKER_GUEST_H_
#define EXTENSIONS_BROWSER_GUEST_VIEW_SURFACE_WORKER_SURFACE_WORKER_GUEST_H_
-#include "extensions/browser/guest_view/guest_view.h"
+#include "components/guest_view/browser/guest_view.h"
namespace extensions {
class Extension;
@@ -13,11 +13,12 @@ class ExtensionHost;
// An SurfaceWorkerGuest provides the browser-side implementation of the
// prototype <wtframe> API.
-class SurfaceWorkerGuest : public GuestView<SurfaceWorkerGuest> {
+class SurfaceWorkerGuest : public guest_view::GuestView<SurfaceWorkerGuest> {
public:
static const char Type[];
- static GuestViewBase* Create(content::WebContents* owner_web_contents);
+ static guest_view::GuestViewBase* Create(
+ content::WebContents* owner_web_contents);
// content::WebContentsDelegate implementation.
bool HandleContextMenu(const content::ContextMenuParams& params) override;
diff --git a/extensions/browser/guest_view/web_view/javascript_dialog_helper.cc b/extensions/browser/guest_view/web_view/javascript_dialog_helper.cc
index 0d3c2b9..1ac3c848 100644
--- a/extensions/browser/guest_view/web_view/javascript_dialog_helper.cc
+++ b/extensions/browser/guest_view/web_view/javascript_dialog_helper.cc
@@ -6,11 +6,11 @@
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
+#include "components/guest_view/common/guest_view_constants.h"
#include "extensions/browser/guest_view/web_view/web_view_constants.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
#include "extensions/browser/guest_view/web_view/web_view_permission_types.h"
-#include "extensions/common/guest_view/guest_view_constants.h"
namespace extensions {
@@ -58,7 +58,7 @@ void JavaScriptDialogHelper::RunJavaScriptDialog(
request_info.Set(webview::kMessageType,
new base::StringValue(
JavaScriptMessageTypeToString(javascript_message_type)));
- request_info.Set(guestview::kUrl, new base::StringValue(origin_url.spec()));
+ request_info.Set(guest_view::kUrl, new base::StringValue(origin_url.spec()));
WebViewPermissionHelper* web_view_permission_helper =
WebViewPermissionHelper::FromWebContents(web_contents);
web_view_permission_helper->RequestPermission(
diff --git a/extensions/browser/guest_view/web_view/web_view_apitest.cc b/extensions/browser/guest_view/web_view/web_view_apitest.cc
index f432276..021a80e 100644
--- a/extensions/browser/guest_view/web_view/web_view_apitest.cc
+++ b/extensions/browser/guest_view/web_view/web_view_apitest.cc
@@ -8,6 +8,9 @@
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "components/guest_view/browser/guest_view_manager_factory.h"
+#include "components/guest_view/browser/test_guest_view_manager.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
@@ -18,9 +21,6 @@
#include "extensions/browser/app_window/app_window_registry.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
-#include "extensions/browser/guest_view/guest_view_manager_factory.h"
-#include "extensions/browser/guest_view/test_guest_view_manager.h"
#include "extensions/browser/process_manager.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_paths.h"
@@ -34,6 +34,9 @@
#include "net/test/embedded_test_server/http_response.h"
#include "ui/gfx/switches.h"
+using guest_view::GuestViewManager;
+using guest_view::TestGuestViewManager;
+
namespace {
const char kEmptyResponsePath[] = "/close-socket";
@@ -248,7 +251,7 @@ TestGuestViewManager* WebViewAPITest::GetGuestViewManager() {
manager = static_cast<TestGuestViewManager*>(
GuestViewManager::CreateWithDelegate(
context,
- scoped_ptr<guestview::GuestViewManagerDelegate>(
+ scoped_ptr<guest_view::GuestViewManagerDelegate>(
new ExtensionsGuestViewManagerDelegate(context))));
}
return manager;
diff --git a/extensions/browser/guest_view/web_view/web_view_apitest.h b/extensions/browser/guest_view/web_view/web_view_apitest.h
index 06ed26a..2824b73 100644
--- a/extensions/browser/guest_view/web_view/web_view_apitest.h
+++ b/extensions/browser/guest_view/web_view/web_view_apitest.h
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "base/values.h"
-#include "extensions/browser/guest_view/test_guest_view_manager.h"
+#include "components/guest_view/browser/test_guest_view_manager.h"
#include "extensions/shell/test/shell_test.h"
#include "ui/gfx/switches.h"
@@ -11,8 +11,11 @@ namespace content {
class WebContents;
} // namespace content
-namespace extensions {
+namespace guestview {
class TestGuestViewManager;
+} // namesapce guestview
+
+namespace extensions {
// Base class for WebView tests in app_shell.
class WebViewAPITest : public AppShellTest {
@@ -33,7 +36,7 @@ class WebViewAPITest : public AppShellTest {
content::WebContents* GetEmbedderWebContents();
// Returns the GuestViewManager singleton.
- TestGuestViewManager* GetGuestViewManager();
+ guest_view::TestGuestViewManager* GetGuestViewManager();
content::WebContents* GetGuestWebContents();
void SendMessageToGuestAndWait(const std::string& message,
@@ -47,7 +50,7 @@ class WebViewAPITest : public AppShellTest {
void TearDownOnMainThread() override;
content::WebContents* embedder_web_contents_;
- TestGuestViewManagerFactory factory_;
+ guest_view::TestGuestViewManagerFactory factory_;
base::DictionaryValue test_config_;
private:
diff --git a/extensions/browser/guest_view/web_view/web_view_content_script_manager.cc b/extensions/browser/guest_view/web_view/web_view_content_script_manager.cc
index 15ede19..ca503dd 100644
--- a/extensions/browser/guest_view/web_view/web_view_content_script_manager.cc
+++ b/extensions/browser/guest_view/web_view/web_view_content_script_manager.cc
@@ -6,6 +6,7 @@
#include "base/lazy_instance.h"
#include "base/memory/linked_ptr.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_details.h"
@@ -15,7 +16,6 @@
#include "extensions/browser/declarative_user_script_manager.h"
#include "extensions/browser/declarative_user_script_master.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "extensions/browser/guest_view/web_view/web_view_constants.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
diff --git a/extensions/browser/guest_view/web_view/web_view_find_helper.cc b/extensions/browser/guest_view/web_view/web_view_find_helper.cc
index 8028e91..d8e0b0b 100644
--- a/extensions/browser/guest_view/web_view/web_view_find_helper.cc
+++ b/extensions/browser/guest_view/web_view/web_view_find_helper.cc
@@ -6,10 +6,12 @@
#include <utility>
+#include "components/guest_view/browser/guest_view_event.h"
#include "extensions/browser/api/guest_view/web_view/web_view_internal_api.h"
-#include "extensions/browser/guest_view/guest_view_event.h"
#include "extensions/browser/guest_view/web_view/web_view_constants.h"
+using guest_view::GuestViewEvent;
+
namespace extensions {
WebViewFindHelper::WebViewFindHelper(WebViewGuest* webview_guest)
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc
index dda0882..15d1ca9 100644
--- a/extensions/browser/guest_view/web_view/web_view_guest.cc
+++ b/extensions/browser/guest_view/web_view/web_view_guest.cc
@@ -8,6 +8,9 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "components/browsing_data/storage_partition_http_cache_data_remover.h"
+#include "components/guest_view/browser/guest_view_event.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "components/guest_view/common/guest_view_constants.h"
#include "components/web_cache/browser/web_cache_manager.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
@@ -37,8 +40,6 @@
#include "extensions/browser/api/guest_view/web_view/web_view_internal_api.h"
#include "extensions/browser/api/web_request/web_request_api.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/browser/guest_view/guest_view_event.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "extensions/browser/guest_view/web_view/web_view_constants.h"
#include "extensions/browser/guest_view/web_view/web_view_content_script_manager.h"
#include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
@@ -46,7 +47,6 @@
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension_messages.h"
-#include "extensions/common/guest_view/guest_view_constants.h"
#include "extensions/strings/grit/extensions_strings.h"
#include "ipc/ipc_message_macros.h"
#include "net/base/escape.h"
@@ -59,6 +59,9 @@ using content::RenderFrameHost;
using content::ResourceType;
using content::StoragePartition;
using content::WebContents;
+using guest_view::GuestViewBase;
+using guest_view::GuestViewEvent;
+using guest_view::GuestViewManager;
using ui_zoom::ZoomController;
namespace extensions {
@@ -245,7 +248,7 @@ int WebViewGuest::GetOrGenerateRulesRegistryID(
int WebViewGuest::GetViewInstanceId(WebContents* contents) {
auto guest = FromWebContents(contents);
if (!guest)
- return guestview::kInstanceIDNone;
+ return guest_view::kInstanceIDNone;
return guest->view_instance_id();
}
@@ -310,7 +313,7 @@ void WebViewGuest::DidAttachToEmbedder() {
void WebViewGuest::DidDropLink(const GURL& url) {
scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
- args->SetString(guestview::kUrl, url.spec());
+ args->SetString(guest_view::kUrl, url.spec());
DispatchEventToView(
new GuestViewEvent(webview::kEventDropLink, args.Pass()));
}
@@ -542,7 +545,7 @@ bool WebViewGuest::PreHandleGestureEvent(content::WebContents* source,
void WebViewGuest::LoadProgressChanged(content::WebContents* source,
double progress) {
scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
- args->SetString(guestview::kUrl, web_contents()->GetURL().spec());
+ args->SetString(guest_view::kUrl, web_contents()->GetURL().spec());
args->SetDouble(webview::kProgress, progress);
DispatchEventToView(
new GuestViewEvent(webview::kEventLoadProgress, args.Pass()));
@@ -553,10 +556,10 @@ void WebViewGuest::LoadAbort(bool is_top_level,
int error_code,
const std::string& error_type) {
scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
- args->SetBoolean(guestview::kIsTopLevel, is_top_level);
- args->SetString(guestview::kUrl, url.possibly_invalid_spec());
- args->SetInteger(guestview::kCode, error_code);
- args->SetString(guestview::kReason, error_type);
+ args->SetBoolean(guest_view::kIsTopLevel, is_top_level);
+ args->SetString(guest_view::kUrl, url.possibly_invalid_spec());
+ args->SetInteger(guest_view::kCode, error_code);
+ args->SetString(guest_view::kReason, error_type);
DispatchEventToView(
new GuestViewEvent(webview::kEventLoadAbort, args.Pass()));
}
@@ -765,8 +768,8 @@ void WebViewGuest::DidCommitProvisionalLoadForFrame(
}
}
scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
- args->SetString(guestview::kUrl, url.spec());
- args->SetBoolean(guestview::kIsTopLevel, !render_frame_host->GetParent());
+ args->SetString(guest_view::kUrl, url.spec());
+ args->SetBoolean(guest_view::kIsTopLevel, !render_frame_host->GetParent());
args->SetString(webview::kInternalBaseURLForDataURL,
web_contents()
->GetController()
@@ -805,8 +808,8 @@ void WebViewGuest::DidStartProvisionalLoadForFrame(
bool is_error_page,
bool is_iframe_srcdoc) {
scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
- args->SetString(guestview::kUrl, validated_url.spec());
- args->SetBoolean(guestview::kIsTopLevel, !render_frame_host->GetParent());
+ args->SetString(guest_view::kUrl, validated_url.spec());
+ args->SetBoolean(guest_view::kIsTopLevel, !render_frame_host->GetParent());
DispatchEventToView(
new GuestViewEvent(webview::kEventLoadStart, args.Pass()));
}
@@ -867,7 +870,7 @@ void WebViewGuest::LoadRedirect(const GURL& old_url,
const GURL& new_url,
bool is_top_level) {
scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
- args->SetBoolean(guestview::kIsTopLevel, is_top_level);
+ args->SetBoolean(guest_view::kIsTopLevel, is_top_level);
args->SetString(webview::kNewURL, new_url.spec());
args->SetString(webview::kOldURL, old_url.spec());
DispatchEventToView(
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.h b/extensions/browser/guest_view/web_view/web_view_guest.h
index 33991ce..6ca0105 100644
--- a/extensions/browser/guest_view/web_view/web_view_guest.h
+++ b/extensions/browser/guest_view/web_view/web_view_guest.h
@@ -8,10 +8,10 @@
#include <vector>
#include "base/observer_list.h"
+#include "components/guest_view/browser/guest_view.h"
#include "content/public/browser/javascript_dialog_manager.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
-#include "extensions/browser/guest_view/guest_view.h"
#include "extensions/browser/guest_view/web_view/javascript_dialog_helper.h"
#include "extensions/browser/guest_view/web_view/web_view_find_helper.h"
#include "extensions/browser/guest_view/web_view/web_view_guest_delegate.h"
@@ -33,7 +33,7 @@ class WebViewInternalFindFunction;
// a particular embedder WebContents. This happens on either initial navigation
// or through the use of the New Window API, when a new window is attached to
// a particular <webview>.
-class WebViewGuest : public GuestView<WebViewGuest>,
+class WebViewGuest : public guest_view::GuestView<WebViewGuest>,
public content::NotificationObserver {
public:
static GuestViewBase* Create(content::WebContents* owner_web_contents);
@@ -50,7 +50,7 @@ class WebViewGuest : public GuestView<WebViewGuest>,
std::string* partition_name,
bool* in_memory);
- // Returns guestview::kInstanceIDNone if |contents| does not correspond to a
+ // Returns guest_view::kInstanceIDNone if |contents| does not correspond to a
// WebViewGuest.
static int GetViewInstanceId(content::WebContents* contents);
diff --git a/extensions/browser/guest_view/web_view/web_view_guest_delegate.h b/extensions/browser/guest_view/web_view/web_view_guest_delegate.h
index 473ffd3d..b6e0f1a 100644
--- a/extensions/browser/guest_view/web_view/web_view_guest_delegate.h
+++ b/extensions/browser/guest_view/web_view/web_view_guest_delegate.h
@@ -6,7 +6,7 @@
#define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_DELEGATE_H_
#include "base/callback.h"
-#include "extensions/browser/guest_view/guest_view_base.h"
+#include "components/guest_view/browser/guest_view_base.h"
namespace content {
class RenderViewHost;
diff --git a/extensions/browser/guest_view/web_view/web_view_permission_helper.cc b/extensions/browser/guest_view/web_view/web_view_permission_helper.cc
index a4585f3..3940043 100644
--- a/extensions/browser/guest_view/web_view/web_view_permission_helper.cc
+++ b/extensions/browser/guest_view/web_view/web_view_permission_helper.cc
@@ -4,11 +4,11 @@
#include "extensions/browser/guest_view/web_view/web_view_permission_helper.h"
+#include "components/guest_view/browser/guest_view_event.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/user_metrics.h"
#include "extensions/browser/api/extensions_api_client.h"
-#include "extensions/browser/guest_view/guest_view_event.h"
#include "extensions/browser/guest_view/web_view/web_view_constants.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/guest_view/web_view/web_view_permission_helper_delegate.h"
@@ -16,6 +16,7 @@
using content::BrowserPluginGuestDelegate;
using content::RenderViewHost;
+using guest_view::GuestViewEvent;
namespace extensions {
@@ -142,7 +143,7 @@ void RecordUserInitiatedUMA(
WebViewPermissionHelper::WebViewPermissionHelper(WebViewGuest* web_view_guest)
: content::WebContentsObserver(web_view_guest->web_contents()),
- next_permission_request_id_(guestview::kInstanceIDNone),
+ next_permission_request_id_(guest_view::kInstanceIDNone),
web_view_guest_(web_view_guest),
weak_factory_(this) {
web_view_permission_helper_delegate_.reset(
@@ -192,7 +193,7 @@ void WebViewPermissionHelper::RequestMediaAccessPermission(
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) {
base::DictionaryValue request_info;
- request_info.SetString(guestview::kUrl, request.security_origin.spec());
+ request_info.SetString(guest_view::kUrl, request.security_origin.spec());
RequestPermission(
WEB_VIEW_PERMISSION_TYPE_MEDIA,
request_info,
diff --git a/extensions/browser/guest_view/web_view/web_view_permission_helper.h b/extensions/browser/guest_view/web_view/web_view_permission_helper.h
index 3ee66b1..18f4368 100644
--- a/extensions/browser/guest_view/web_view/web_view_permission_helper.h
+++ b/extensions/browser/guest_view/web_view/web_view_permission_helper.h
@@ -7,11 +7,11 @@
#include "base/memory/weak_ptr.h"
#include "base/metrics/user_metrics_action.h"
+#include "components/guest_view/common/guest_view_constants.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/media_stream_request.h"
#include "extensions/browser/guest_view/web_view/web_view_permission_types.h"
-#include "extensions/common/guest_view/guest_view_constants.h"
using base::UserMetricsAction;
diff --git a/extensions/common/extension_message_generator.h b/extensions/common/extension_message_generator.h
index 664514c..b2c61f1 100644
--- a/extensions/common/extension_message_generator.h
+++ b/extensions/common/extension_message_generator.h
@@ -7,4 +7,3 @@
#include "extensions/common/extension_messages.h"
#include "extensions/common/extension_utility_messages.h"
#include "extensions/common/guest_view/extensions_guest_view_messages.h"
-#include "extensions/common/guest_view/guest_view_messages.h"
diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp
index a057839..b42c944 100644
--- a/extensions/extensions.gyp
+++ b/extensions/extensions.gyp
@@ -126,6 +126,7 @@
'../base/base.gyp:base_prefs',
'../components/components.gyp:browsing_data',
'../components/components.gyp:device_event_log_component',
+ '../components/components.gyp:guest_view',
'../components/components.gyp:keyed_service_content',
'../components/components.gyp:keyed_service_core',
'../components/components.gyp:onc_component',
@@ -207,6 +208,7 @@
'type': 'static_library',
'dependencies': [
'extensions_resources.gyp:extensions_resources',
+ '../components/components.gyp:guest_view',
'../content/content.gyp:content_resources',
'../gin/gin.gyp:gin',
'../third_party/WebKit/public/blink.gyp:blink',
diff --git a/extensions/extensions.gypi b/extensions/extensions.gypi
index 5d2d835..f0c90f3 100644
--- a/extensions/extensions.gypi
+++ b/extensions/extensions.gypi
@@ -93,9 +93,6 @@
'common/file_util.cc',
'common/file_util.h',
'common/guest_view/extensions_guest_view_messages.h',
- 'common/guest_view/guest_view_constants.cc',
- 'common/guest_view/guest_view_constants.h',
- 'common/guest_view/guest_view_messages.h',
'common/host_id.cc',
'common/host_id.h',
'common/image_util.cc',
@@ -642,17 +639,6 @@
'browser/guest_view/extensions_guest_view_manager_delegate.h',
'browser/guest_view/extensions_guest_view_message_filter.cc',
'browser/guest_view/extensions_guest_view_message_filter.h',
- 'browser/guest_view/guest_view.h',
- 'browser/guest_view/guest_view_base.cc',
- 'browser/guest_view/guest_view_base.h',
- 'browser/guest_view/guest_view_event.cc',
- 'browser/guest_view/guest_view_event.h',
- 'browser/guest_view/guest_view_manager.cc',
- 'browser/guest_view/guest_view_manager.h',
- 'browser/guest_view/guest_view_manager_delegate.h',
- 'browser/guest_view/guest_view_manager_factory.h',
- 'browser/guest_view/guest_view_message_filter.cc',
- 'browser/guest_view/guest_view_message_filter.h',
'browser/guest_view/mime_handler_view/mime_handler_stream_manager.cc',
'browser/guest_view/mime_handler_view/mime_handler_stream_manager.h',
'browser/guest_view/mime_handler_view/mime_handler_view_constants.cc',
@@ -1015,8 +1001,6 @@
'browser/extension_error_test_util.h',
'browser/extensions_test.cc',
'browser/extensions_test.h',
- 'browser/guest_view/test_guest_view_manager.cc',
- 'browser/guest_view/test_guest_view_manager.h',
'browser/mock_extension_system.cc',
'browser/mock_extension_system.h',
'browser/test_extension_registry_observer.cc',
diff --git a/extensions/extensions_tests.gyp b/extensions/extensions_tests.gyp
index e68f274..10a187f 100644
--- a/extensions/extensions_tests.gyp
+++ b/extensions/extensions_tests.gyp
@@ -72,6 +72,8 @@
'shell/app_shell.gyp:app_shell_lib',
# TODO(yoz): find the right deps
'<(DEPTH)/base/base.gyp:test_support_base',
+ '<(DEPTH)/components/components.gyp:guest_view',
+ '<(DEPTH)/components/components.gyp:guest_view_test_support',
'<(DEPTH)/content/content.gyp:content_app_both',
'<(DEPTH)/content/content_shell_and_tests.gyp:content_browser_test_support',
'<(DEPTH)/content/content_shell_and_tests.gyp:test_support_content',
diff --git a/extensions/extensions_tests.gypi b/extensions/extensions_tests.gypi
index 089c2eb..deb11cc 100644
--- a/extensions/extensions_tests.gypi
+++ b/extensions/extensions_tests.gypi
@@ -81,7 +81,6 @@
'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/info_map_unittest.cc',
'browser/lazy_background_task_queue_unittest.cc',
diff --git a/extensions/renderer/guest_view/extensions_guest_view_container.cc b/extensions/renderer/guest_view/extensions_guest_view_container.cc
index f453030..5b43598 100644
--- a/extensions/renderer/guest_view/extensions_guest_view_container.cc
+++ b/extensions/renderer/guest_view/extensions_guest_view_container.cc
@@ -4,10 +4,10 @@
#include "extensions/renderer/guest_view/extensions_guest_view_container.h"
+#include "components/guest_view/common/guest_view_constants.h"
+#include "components/guest_view/common/guest_view_messages.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h"
-#include "extensions/common/guest_view/guest_view_constants.h"
-#include "extensions/common/guest_view/guest_view_messages.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h"
#include "third_party/WebKit/public/web/WebView.h"
@@ -142,7 +142,7 @@ ExtensionsGuestViewContainer::ExtensionsGuestViewContainer(
}
ExtensionsGuestViewContainer::~ExtensionsGuestViewContainer() {
- if (element_instance_id() != guestview::kInstanceIDNone)
+ if (element_instance_id() != guest_view::kInstanceIDNone)
g_guest_view_container_map.Get().erase(element_instance_id());
if (pending_response_.get())
diff --git a/extensions/renderer/guest_view/guest_view_container.cc b/extensions/renderer/guest_view/guest_view_container.cc
index 787e439..8a44d5a 100644
--- a/extensions/renderer/guest_view/guest_view_container.cc
+++ b/extensions/renderer/guest_view/guest_view_container.cc
@@ -4,12 +4,12 @@
#include "extensions/renderer/guest_view/guest_view_container.h"
+#include "components/guest_view/common/guest_view_constants.h"
+#include "components/guest_view/common/guest_view_messages.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_view.h"
#include "extensions/common/guest_view/extensions_guest_view_messages.h"
-#include "extensions/common/guest_view/guest_view_constants.h"
-#include "extensions/common/guest_view/guest_view_messages.h"
namespace extensions {
@@ -39,7 +39,7 @@ void GuestViewContainer::RenderFrameLifetimeObserver::OnDestruct() {
}
GuestViewContainer::GuestViewContainer(content::RenderFrame* render_frame)
- : element_instance_id_(guestview::kInstanceIDNone),
+ : element_instance_id_(guest_view::kInstanceIDNone),
render_frame_(render_frame) {
render_frame_lifetime_observer_.reset(
new RenderFrameLifetimeObserver(this, render_frame_));
@@ -66,7 +66,7 @@ void GuestViewContainer::RenderFrameDestroyed() {
}
void GuestViewContainer::SetElementInstanceID(int element_instance_id) {
- DCHECK_EQ(element_instance_id_, guestview::kInstanceIDNone);
+ DCHECK_EQ(element_instance_id_, guest_view::kInstanceIDNone);
element_instance_id_ = element_instance_id;
}
diff --git a/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc b/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc
index 2310d3d..9f8d952 100644
--- a/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc
+++ b/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc
@@ -7,11 +7,11 @@
#include <string>
#include "base/bind.h"
+#include "components/guest_view/common/guest_view_constants.h"
#include "content/public/child/v8_value_converter.h"
#include "content/public/renderer/render_view.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_messages.h"
-#include "extensions/common/guest_view/guest_view_constants.h"
#include "extensions/renderer/guest_view/extensions_guest_view_container.h"
#include "extensions/renderer/script_context.h"
#include "third_party/WebKit/public/web/WebFrame.h"
@@ -87,7 +87,7 @@ void GuestViewInternalCustomBindings::AttachGuest(
// Add flag to |params| to indicate that the element size is specified in
// logical units.
- params->SetBoolean(guestview::kElementSizeIsLogical, true);
+ params->SetBoolean(guest_view::kElementSizeIsLogical, true);
linked_ptr<ExtensionsGuestViewContainer::Request> request(
new ExtensionsGuestViewContainer::AttachRequest(
diff --git a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc
index c8b6afa..67add24 100644
--- a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc
+++ b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc
@@ -7,14 +7,14 @@
#include <map>
#include <set>
+#include "components/guest_view/common/guest_view_constants.h"
+#include "components/guest_view/common/guest_view_messages.h"
#include "content/public/child/v8_value_converter.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_constants.h"
#include "extensions/common/extension_messages.h"
#include "extensions/common/guest_view/extensions_guest_view_messages.h"
-#include "extensions/common/guest_view/guest_view_constants.h"
-#include "extensions/common/guest_view/guest_view_messages.h"
#include "gin/arguments.h"
#include "gin/dictionary.h"
#include "gin/handle.h"
@@ -264,7 +264,7 @@ void MimeHandlerViewContainer::PostMessageFromValue(
void MimeHandlerViewContainer::OnCreateMimeHandlerViewGuestACK(
int element_instance_id) {
- DCHECK_NE(this->element_instance_id(), guestview::kInstanceIDNone);
+ DCHECK_NE(this->element_instance_id(), guest_view::kInstanceIDNone);
DCHECK_EQ(this->element_instance_id(), element_instance_id);
if (!render_frame())
@@ -307,7 +307,7 @@ void MimeHandlerViewContainer::CreateMimeHandlerViewGuest() {
// The loader has completed loading |view_id_| so we can dispose it.
loader_.reset();
- DCHECK_NE(element_instance_id(), guestview::kInstanceIDNone);
+ DCHECK_NE(element_instance_id(), guest_view::kInstanceIDNone);
if (!render_frame())
return;
diff --git a/extensions/renderer/messaging_bindings.cc b/extensions/renderer/messaging_bindings.cc
index de53de9..b4b315b 100644
--- a/extensions/renderer/messaging_bindings.cc
+++ b/extensions/renderer/messaging_bindings.cc
@@ -13,13 +13,13 @@
#include "base/lazy_instance.h"
#include "base/message_loop/message_loop.h"
#include "base/values.h"
+#include "components/guest_view/common/guest_view_constants.h"
#include "content/public/child/v8_value_converter.h"
#include "content/public/common/child_process_host.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_thread.h"
#include "extensions/common/api/messaging/message.h"
#include "extensions/common/extension_messages.h"
-#include "extensions/common/guest_view/guest_view_constants.h"
#include "extensions/common/manifest_handlers/externally_connectable.h"
#include "extensions/renderer/dispatcher.h"
#include "extensions/renderer/event_bindings.h"
diff --git a/extensions/shell/BUILD.gn b/extensions/shell/BUILD.gn
index b7bf9ce..09cbb82 100644
--- a/extensions/shell/BUILD.gn
+++ b/extensions/shell/BUILD.gn
@@ -33,6 +33,7 @@ source_set("app_shell_lib") {
"//base:prefs",
"//components/devtools_discovery",
"//components/devtools_http_handler",
+ "//components/guest_view:guest_view",
"//components/pref_registry",
"//components/update_client",
"//components/user_prefs",
diff --git a/extensions/shell/browser/shell_browser_context.cc b/extensions/shell/browser/shell_browser_context.cc
index 827eabe..745770b 100644
--- a/extensions/shell/browser/shell_browser_context.cc
+++ b/extensions/shell/browser/shell_browser_context.cc
@@ -5,9 +5,9 @@
#include "extensions/shell/browser/shell_browser_context.h"
#include "base/command_line.h"
+#include "components/guest_view/browser/guest_view_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_switches.h"
-#include "extensions/browser/guest_view/guest_view_manager.h"
#include "extensions/shell/browser/shell_network_delegate.h"
#include "extensions/shell/browser/shell_special_storage_policy.h"
#include "extensions/shell/browser/shell_url_request_context_getter.h"
@@ -35,7 +35,7 @@ ShellBrowserContext::~ShellBrowserContext() {
}
content::BrowserPluginGuestManager* ShellBrowserContext::GetGuestManager() {
- return GuestViewManager::FromBrowserContext(this);
+ return guest_view::GuestViewManager::FromBrowserContext(this);
}
storage::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() {
diff --git a/extensions/shell/browser/shell_content_browser_client.cc b/extensions/shell/browser/shell_content_browser_client.cc
index 4aba570..dbb7f6f 100644
--- a/extensions/shell/browser/shell_content_browser_client.cc
+++ b/extensions/shell/browser/shell_content_browser_client.cc
@@ -5,6 +5,7 @@
#include "extensions/shell/browser/shell_content_browser_client.h"
#include "base/command_line.h"
+#include "components/guest_view/browser/guest_view_message_filter.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/site_instance.h"
@@ -16,7 +17,7 @@
#include "extensions/browser/extension_message_filter.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/extension_registry.h"
-#include "extensions/browser/guest_view/guest_view_message_filter.h"
+#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
#include "extensions/browser/info_map.h"
#include "extensions/browser/io_thread_extension_message_filter.h"
#include "extensions/browser/process_map.h"
@@ -93,7 +94,11 @@ void ShellContentBrowserClient::RenderProcessWillLaunch(
host->AddFilter(
new IOThreadExtensionMessageFilter(render_process_id, browser_context));
host->AddFilter(
- new GuestViewMessageFilter(render_process_id, browser_context));
+ new guest_view::GuestViewMessageFilter(
+ render_process_id, browser_context));
+ host->AddFilter(
+ new ExtensionsGuestViewMessageFilter(
+ render_process_id, browser_context));
// PluginInfoMessageFilter is not required because app_shell does not have
// the concept of disabled plugins.
#if !defined(DISABLE_NACL)