OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "extensions/browser/guest_view/extension_options/extension_options_gues
t.h" | 5 #include "extensions/browser/guest_view/extension_options/extension_options_gues
t.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "components/crx_file/id_util.h" | 8 #include "components/crx_file/id_util.h" |
9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
10 #include "content/public/browser/site_instance.h" | 10 #include "content/public/browser/site_instance.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 content::SiteInstance::CreateForURL(browser_context(), extension_url); | 102 content::SiteInstance::CreateForURL(browser_context(), extension_url); |
103 WebContents::CreateParams params(browser_context(), options_site_instance); | 103 WebContents::CreateParams params(browser_context(), options_site_instance); |
104 params.guest_delegate = this; | 104 params.guest_delegate = this; |
105 callback.Run(WebContents::Create(params)); | 105 callback.Run(WebContents::Create(params)); |
106 } | 106 } |
107 | 107 |
108 void ExtensionOptionsGuest::DidAttachToEmbedder() { | 108 void ExtensionOptionsGuest::DidAttachToEmbedder() { |
109 SetUpAutoSize(); | 109 SetUpAutoSize(); |
110 web_contents()->GetController().LoadURL(options_page_, | 110 web_contents()->GetController().LoadURL(options_page_, |
111 content::Referrer(), | 111 content::Referrer(), |
112 content::PAGE_TRANSITION_LINK, | 112 ui::PAGE_TRANSITION_LINK, |
113 std::string()); | 113 std::string()); |
114 } | 114 } |
115 | 115 |
116 void ExtensionOptionsGuest::DidInitialize() { | 116 void ExtensionOptionsGuest::DidInitialize() { |
117 extension_function_dispatcher_.reset( | 117 extension_function_dispatcher_.reset( |
118 new extensions::ExtensionFunctionDispatcher(browser_context(), this)); | 118 new extensions::ExtensionFunctionDispatcher(browser_context(), this)); |
119 if (extension_options_guest_delegate_) { | 119 if (extension_options_guest_delegate_) { |
120 extension_options_guest_delegate_->DidInitialize(); | 120 extension_options_guest_delegate_->DidInitialize(); |
121 } | 121 } |
122 } | 122 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // external links to be opened in a new tab, not in a new guest view. | 204 // external links to be opened in a new tab, not in a new guest view. |
205 // Therefore we just open the URL in a new tab, and since we aren't handling | 205 // Therefore we just open the URL in a new tab, and since we aren't handling |
206 // the new web contents, we return false. | 206 // the new web contents, we return false. |
207 // TODO(ericzeng): Open the tab in the background if the click was a | 207 // TODO(ericzeng): Open the tab in the background if the click was a |
208 // ctrl-click or middle mouse button click | 208 // ctrl-click or middle mouse button click |
209 if (extension_options_guest_delegate_) { | 209 if (extension_options_guest_delegate_) { |
210 extension_options_guest_delegate_->OpenURLInNewTab( | 210 extension_options_guest_delegate_->OpenURLInNewTab( |
211 content::OpenURLParams(target_url, | 211 content::OpenURLParams(target_url, |
212 content::Referrer(), | 212 content::Referrer(), |
213 NEW_FOREGROUND_TAB, | 213 NEW_FOREGROUND_TAB, |
214 content::PAGE_TRANSITION_LINK, | 214 ui::PAGE_TRANSITION_LINK, |
215 false)); | 215 false)); |
216 } | 216 } |
217 return false; | 217 return false; |
218 } | 218 } |
219 | 219 |
220 bool ExtensionOptionsGuest::OnMessageReceived(const IPC::Message& message) { | 220 bool ExtensionOptionsGuest::OnMessageReceived(const IPC::Message& message) { |
221 bool handled = true; | 221 bool handled = true; |
222 IPC_BEGIN_MESSAGE_MAP(ExtensionOptionsGuest, message) | 222 IPC_BEGIN_MESSAGE_MAP(ExtensionOptionsGuest, message) |
223 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) | 223 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) |
224 IPC_MESSAGE_UNHANDLED(handled = false) | 224 IPC_MESSAGE_UNHANDLED(handled = false) |
(...skipping 26 matching lines...) Expand all Loading... |
251 attach_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); | 251 attach_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); |
252 | 252 |
253 // Call SetAutoSize to apply all the appropriate validation and clipping of | 253 // Call SetAutoSize to apply all the appropriate validation and clipping of |
254 // values. | 254 // values. |
255 SetAutoSize(auto_size_enabled, | 255 SetAutoSize(auto_size_enabled, |
256 gfx::Size(min_width, min_height), | 256 gfx::Size(min_width, min_height), |
257 gfx::Size(max_width, max_height)); | 257 gfx::Size(max_width, max_height)); |
258 } | 258 } |
259 | 259 |
260 } // namespace extensions | 260 } // namespace extensions |
OLD | NEW |