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

Side by Side Diff: extensions/browser/guest_view/extension_options/extension_options_guest.cc

Issue 856563002: Added the infrastructure for surfaceProxy.onResize() and SurfaceView.onResize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Added a bit more infrastructure than in the previous patch. 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 unified diff | Download patch
OLDNEW
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/metrics/user_metrics.h" 7 #include "base/metrics/user_metrics.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "components/crx_file/id_util.h" 9 #include "components/crx_file/id_util.h"
10 #include "content/public/browser/navigation_details.h" 10 #include "content/public/browser/navigation_details.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 const base::DictionaryValue& create_params) { 133 const base::DictionaryValue& create_params) {
134 extension_function_dispatcher_.reset( 134 extension_function_dispatcher_.reset(
135 new extensions::ExtensionFunctionDispatcher(browser_context(), this)); 135 new extensions::ExtensionFunctionDispatcher(browser_context(), this));
136 if (extension_options_guest_delegate_) { 136 if (extension_options_guest_delegate_) {
137 extension_options_guest_delegate_->DidInitialize(); 137 extension_options_guest_delegate_->DidInitialize();
138 } 138 }
139 } 139 }
140 140
141 void ExtensionOptionsGuest::DidStopLoading() { 141 void ExtensionOptionsGuest::DidStopLoading() {
142 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 142 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
143 DispatchEventToEmbedder(new extensions::GuestViewBase::Event( 143 DispatchEventToView(new extensions::GuestViewBase::Event(
Fady Samuel 2015/01/19 23:57:00 nit: remove extensions::
paulmeyer 2015/01/20 00:24:38 Done.
144 extension_options_internal::OnLoad::kEventName, args.Pass())); 144 extension_options_internal::OnLoad::kEventName, args.Pass()));
145 } 145 }
146 146
147 const char* ExtensionOptionsGuest::GetAPINamespace() const { 147 const char* ExtensionOptionsGuest::GetAPINamespace() const {
148 return extensionoptions::kAPINamespace; 148 return extensionoptions::kAPINamespace;
149 } 149 }
150 150
151 int ExtensionOptionsGuest::GetTaskPrefix() const { 151 int ExtensionOptionsGuest::GetTaskPrefix() const {
152 return IDS_EXTENSION_TASK_MANAGER_EXTENSIONOPTIONS_TAG_PREFIX; 152 return IDS_EXTENSION_TASK_MANAGER_EXTENSIONOPTIONS_TAG_PREFIX;
153 } 153 }
154 154
155 void ExtensionOptionsGuest::GuestSizeChangedDueToAutoSize( 155 void ExtensionOptionsGuest::GuestSizeChangedDueToAutoSize(
156 const gfx::Size& old_size, 156 const gfx::Size& old_size,
157 const gfx::Size& new_size) { 157 const gfx::Size& new_size) {
158 extension_options_internal::SizeChangedOptions options; 158 extension_options_internal::SizeChangedOptions options;
159 options.old_width = old_size.width(); 159 options.old_width = old_size.width();
160 options.old_height = old_size.height(); 160 options.old_height = old_size.height();
161 options.new_width = new_size.width(); 161 options.new_width = new_size.width();
162 options.new_height = new_size.height(); 162 options.new_height = new_size.height();
163 DispatchEventToEmbedder(new extensions::GuestViewBase::Event( 163 DispatchEventToView(new extensions::GuestViewBase::Event(
Fady Samuel 2015/01/19 23:57:00 nit: remove extensions::
paulmeyer 2015/01/20 00:24:38 Done.
164 extension_options_internal::OnSizeChanged::kEventName, 164 extension_options_internal::OnSizeChanged::kEventName,
165 options.ToValue())); 165 options.ToValue()));
166 } 166 }
167 167
168 void ExtensionOptionsGuest::OnPreferredSizeChanged(const gfx::Size& pref_size) { 168 void ExtensionOptionsGuest::OnPreferredSizeChanged(const gfx::Size& pref_size) {
169 extension_options_internal::PreferredSizeChangedOptions options; 169 extension_options_internal::PreferredSizeChangedOptions options;
170 options.width = pref_size.width(); 170 options.width = pref_size.width();
171 options.height = pref_size.height(); 171 options.height = pref_size.height();
172 DispatchEventToEmbedder(new extensions::GuestViewBase::Event( 172 DispatchEventToView(new extensions::GuestViewBase::Event(
Fady Samuel 2015/01/19 23:57:00 nit: remove extensions::
paulmeyer 2015/01/20 00:24:38 Done.
173 extension_options_internal::OnPreferredSizeChanged::kEventName, 173 extension_options_internal::OnPreferredSizeChanged::kEventName,
174 options.ToValue())); 174 options.ToValue()));
175 } 175 }
176 176
177 bool ExtensionOptionsGuest::IsAutoSizeSupported() const { 177 bool ExtensionOptionsGuest::IsAutoSizeSupported() const {
178 return true; 178 return true;
179 } 179 }
180 180
181 bool ExtensionOptionsGuest::IsPreferredSizeModeEnabled() const { 181 bool ExtensionOptionsGuest::IsPreferredSizeModeEnabled() const {
182 return true; 182 return true;
(...skipping 19 matching lines...) Expand all
202 params.referrer, 202 params.referrer,
203 params.frame_tree_node_id, 203 params.frame_tree_node_id,
204 NEW_FOREGROUND_TAB, 204 NEW_FOREGROUND_TAB,
205 params.transition, 205 params.transition,
206 params.is_renderer_initiated)); 206 params.is_renderer_initiated));
207 } 207 }
208 return extension_options_guest_delegate_->OpenURLInNewTab(params); 208 return extension_options_guest_delegate_->OpenURLInNewTab(params);
209 } 209 }
210 210
211 void ExtensionOptionsGuest::CloseContents(content::WebContents* source) { 211 void ExtensionOptionsGuest::CloseContents(content::WebContents* source) {
212 DispatchEventToEmbedder(new extensions::GuestViewBase::Event( 212 DispatchEventToView(new extensions::GuestViewBase::Event(
Fady Samuel 2015/01/19 23:57:01 nit: remove extensions::
paulmeyer 2015/01/20 00:24:38 Done.
213 extension_options_internal::OnClose::kEventName, 213 extension_options_internal::OnClose::kEventName,
214 make_scoped_ptr(new base::DictionaryValue()))); 214 make_scoped_ptr(new base::DictionaryValue())));
215 } 215 }
216 216
217 bool ExtensionOptionsGuest::HandleContextMenu( 217 bool ExtensionOptionsGuest::HandleContextMenu(
218 const content::ContextMenuParams& params) { 218 const content::ContextMenuParams& params) {
219 if (!extension_options_guest_delegate_) 219 if (!extension_options_guest_delegate_)
220 return false; 220 return false;
221 221
222 return extension_options_guest_delegate_->HandleContextMenu(params); 222 return extension_options_guest_delegate_->HandleContextMenu(params);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 return handled; 268 return handled;
269 } 269 }
270 270
271 void ExtensionOptionsGuest::OnRequest( 271 void ExtensionOptionsGuest::OnRequest(
272 const ExtensionHostMsg_Request_Params& params) { 272 const ExtensionHostMsg_Request_Params& params) {
273 extension_function_dispatcher_->Dispatch(params, 273 extension_function_dispatcher_->Dispatch(params,
274 web_contents()->GetRenderViewHost()); 274 web_contents()->GetRenderViewHost());
275 } 275 }
276 276
277 } // namespace extensions 277 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698