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 "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 Loading... |
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::kNewWidth, new_size.width()); | 154 args->SetInteger(extensionoptions::kWidth, new_size.width()); |
155 args->SetInteger(extensionoptions::kNewHeight, new_size.height()); | 155 args->SetInteger(extensionoptions::kHeight, new_size.height()); |
156 args->SetInteger(extensionoptions::kOldWidth, old_size.width()); | |
157 args->SetInteger(extensionoptions::kOldHeight, old_size.height()); | |
158 DispatchEventToEmbedder(new extensions::GuestViewBase::Event( | 156 DispatchEventToEmbedder(new extensions::GuestViewBase::Event( |
159 extension_options_internal::OnSizeChanged::kEventName, args.Pass())); | 157 extension_options_internal::OnSizeChanged::kEventName, args.Pass())); |
160 } | 158 } |
161 | 159 |
162 bool ExtensionOptionsGuest::IsAutoSizeSupported() const { | 160 bool ExtensionOptionsGuest::IsAutoSizeSupported() const { |
163 return true; | 161 return true; |
164 } | 162 } |
165 | 163 |
166 void ExtensionOptionsGuest::SetUpAutoSize() { | 164 void ExtensionOptionsGuest::SetUpAutoSize() { |
167 // Read the autosize parameters passed in from the embedder. | 165 // Read the autosize parameters passed in from the embedder. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 content::OpenURLParams params(target_url, | 203 content::OpenURLParams params(target_url, |
206 content::Referrer(), | 204 content::Referrer(), |
207 NEW_FOREGROUND_TAB, | 205 NEW_FOREGROUND_TAB, |
208 content::PAGE_TRANSITION_LINK, | 206 content::PAGE_TRANSITION_LINK, |
209 false); | 207 false); |
210 browser->OpenURL(params); | 208 browser->OpenURL(params); |
211 // TODO(ericzeng): Open the tab in the background if the click was a | 209 // TODO(ericzeng): Open the tab in the background if the click was a |
212 // ctrl-click or middle mouse button click | 210 // ctrl-click or middle mouse button click |
213 return false; | 211 return false; |
214 } | 212 } |
OLD | NEW |