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

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

Issue 480243003: Implement smoother autosizing of the extension options overlay (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 4 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 "chrome/browser/guest_view/extension_options/extension_options_guest.h" 5 #include "chrome/browser/guest_view/extension_options/extension_options_guest.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" 8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
9 #include "chrome/browser/extensions/extension_tab_util.h" 9 #include "chrome/browser/extensions/extension_tab_util.h"
10 #include "chrome/browser/guest_view/extension_options/extension_options_constant s.h" 10 #include "chrome/browser/guest_view/extension_options/extension_options_constant s.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 void ExtensionOptionsGuest::OnRequest( 144 void ExtensionOptionsGuest::OnRequest(
145 const ExtensionHostMsg_Request_Params& params) { 145 const ExtensionHostMsg_Request_Params& params) {
146 extension_function_dispatcher_->Dispatch( 146 extension_function_dispatcher_->Dispatch(
147 params, guest_web_contents()->GetRenderViewHost()); 147 params, guest_web_contents()->GetRenderViewHost());
148 } 148 }
149 149
150 void ExtensionOptionsGuest::GuestSizeChangedDueToAutoSize( 150 void ExtensionOptionsGuest::GuestSizeChangedDueToAutoSize(
151 const gfx::Size& old_size, 151 const gfx::Size& old_size,
152 const gfx::Size& new_size) { 152 const gfx::Size& new_size) {
153 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 153 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
154 args->SetInteger(extensionoptions::kWidth, new_size.width()); 154 args->SetInteger(extensionoptions::kNewWidth, new_size.width());
155 args->SetInteger(extensionoptions::kHeight, new_size.height()); 155 args->SetInteger(extensionoptions::kNewHeight, new_size.height());
156 args->SetInteger(extensionoptions::kOldWidth, old_size.width());
157 args->SetInteger(extensionoptions::kOldHeight, old_size.height());
156 DispatchEventToEmbedder(new extensions::GuestViewBase::Event( 158 DispatchEventToEmbedder(new extensions::GuestViewBase::Event(
157 extension_options_internal::OnSizeChanged::kEventName, args.Pass())); 159 extension_options_internal::OnSizeChanged::kEventName, args.Pass()));
158 } 160 }
159 161
160 bool ExtensionOptionsGuest::IsAutoSizeSupported() const { 162 bool ExtensionOptionsGuest::IsAutoSizeSupported() const {
161 return true; 163 return true;
162 } 164 }
163 165
164 void ExtensionOptionsGuest::SetUpAutoSize() { 166 void ExtensionOptionsGuest::SetUpAutoSize() {
165 // Read the autosize parameters passed in from the embedder. 167 // Read the autosize parameters passed in from the embedder.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 content::OpenURLParams params(target_url, 211 content::OpenURLParams params(target_url,
210 content::Referrer(), 212 content::Referrer(),
211 NEW_FOREGROUND_TAB, 213 NEW_FOREGROUND_TAB,
212 content::PAGE_TRANSITION_LINK, 214 content::PAGE_TRANSITION_LINK,
213 false); 215 false);
214 browser->OpenURL(params); 216 browser->OpenURL(params);
215 // TODO(ericzeng): Open the tab in the background if the click was a 217 // TODO(ericzeng): Open the tab in the background if the click was a
216 // ctrl-click or middle mouse button click 218 // ctrl-click or middle mouse button click
217 return false; 219 return false;
218 } 220 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698