Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1709)

Unified Diff: extensions/browser/guest_view/extension_options/extension_options_guest.cc

Issue 845363004: <webview>, <appview> and <extensionoptions> can run in a detached state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/guest_view/extension_options/extension_options_guest.cc
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 5c78dbd610d926c982e774dd82aac9a684b85941..f11e2b00410150c5a5c206c5cf333531cea7dfb9 100644
--- a/extensions/browser/guest_view/extension_options/extension_options_guest.cc
+++ b/extensions/browser/guest_view/extension_options/extension_options_guest.cc
@@ -42,8 +42,7 @@ ExtensionOptionsGuest::ExtensionOptionsGuest(
: GuestView<ExtensionOptionsGuest>(owner_web_contents, guest_instance_id),
extension_options_guest_delegate_(
extensions::ExtensionsAPIClient::Get()
- ->CreateExtensionOptionsGuestDelegate(this)),
- has_navigated_(false) {
+ ->CreateExtensionOptionsGuestDelegate(this)) {
}
ExtensionOptionsGuest::~ExtensionOptionsGuest() {
@@ -56,6 +55,10 @@ extensions::GuestViewBase* ExtensionOptionsGuest::Create(
return new ExtensionOptionsGuest(owner_web_contents, guest_instance_id);
}
+bool ExtensionOptionsGuest::CanRunInDetachedState() const {
+ return true;
+}
+
void ExtensionOptionsGuest::CreateWebContents(
const base::DictionaryValue& create_params,
const WebContentsCreatedCallback& callback) {
@@ -111,18 +114,6 @@ void ExtensionOptionsGuest::CreateWebContents(
callback.Run(WebContents::Create(params));
}
-void ExtensionOptionsGuest::DidAttachToEmbedder() {
- // We should not re-navigate on reattachment.
- if (has_navigated_)
- return;
-
- web_contents()->GetController().LoadURL(options_page_,
- content::Referrer(),
- ui::PAGE_TRANSITION_LINK,
- std::string());
- has_navigated_ = true;
-}
-
void ExtensionOptionsGuest::DidInitialize(
const base::DictionaryValue& create_params) {
extension_function_dispatcher_.reset(
@@ -130,6 +121,10 @@ void ExtensionOptionsGuest::DidInitialize(
if (extension_options_guest_delegate_) {
extension_options_guest_delegate_->DidInitialize();
}
+ web_contents()->GetController().LoadURL(options_page_,
+ content::Referrer(),
+ ui::PAGE_TRANSITION_LINK,
+ std::string());
}
void ExtensionOptionsGuest::DidStopLoading() {
@@ -159,6 +154,14 @@ void ExtensionOptionsGuest::GuestSizeChangedDueToAutoSize(
options.ToValue()));
}
+bool ExtensionOptionsGuest::IsAutoSizeSupported() const {
+ return true;
+}
+
+bool ExtensionOptionsGuest::IsPreferredSizeModeEnabled() const {
+ return true;
+}
+
void ExtensionOptionsGuest::OnPreferredSizeChanged(const gfx::Size& pref_size) {
extension_options_internal::PreferredSizeChangedOptions options;
options.width = pref_size.width();
@@ -168,14 +171,6 @@ void ExtensionOptionsGuest::OnPreferredSizeChanged(const gfx::Size& pref_size) {
options.ToValue()));
}
-bool ExtensionOptionsGuest::IsAutoSizeSupported() const {
- return true;
-}
-
-bool ExtensionOptionsGuest::IsPreferredSizeModeEnabled() const {
- return true;
-}
-
content::WebContents* ExtensionOptionsGuest::GetAssociatedWebContents() const {
return web_contents();
}

Powered by Google App Engine
This is Rietveld 408576698