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/guest_view/extension_options/extension_options_constant
s.h" | 9 #include "chrome/browser/guest_view/extension_options/extension_options_constant
s.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 void ExtensionOptionsGuest::OnRequest( | 137 void ExtensionOptionsGuest::OnRequest( |
138 const ExtensionHostMsg_Request_Params& params) { | 138 const ExtensionHostMsg_Request_Params& params) { |
139 extension_function_dispatcher_->Dispatch( | 139 extension_function_dispatcher_->Dispatch( |
140 params, guest_web_contents()->GetRenderViewHost()); | 140 params, guest_web_contents()->GetRenderViewHost()); |
141 } | 141 } |
142 | 142 |
143 void ExtensionOptionsGuest::GuestSizeChangedDueToAutoSize( | 143 void ExtensionOptionsGuest::GuestSizeChangedDueToAutoSize( |
144 const gfx::Size& old_size, | 144 const gfx::Size& old_size, |
145 const gfx::Size& new_size) { | 145 const gfx::Size& new_size) { |
146 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 146 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
147 args->SetInteger(extensionoptions::kWidth, new_size.width()); | 147 args->SetInteger(extensionoptions::kNewWidth, new_size.width()); |
148 args->SetInteger(extensionoptions::kHeight, new_size.height()); | 148 args->SetInteger(extensionoptions::kNewHeight, new_size.height()); |
| 149 args->SetInteger(extensionoptions::kOldWidth, old_size.width()); |
| 150 args->SetInteger(extensionoptions::kOldHeight, old_size.height()); |
149 DispatchEventToEmbedder(new extensions::GuestViewBase::Event( | 151 DispatchEventToEmbedder(new extensions::GuestViewBase::Event( |
150 extension_options_internal::OnSizeChanged::kEventName, args.Pass())); | 152 extension_options_internal::OnSizeChanged::kEventName, args.Pass())); |
151 } | 153 } |
152 | 154 |
153 bool ExtensionOptionsGuest::IsAutoSizeSupported() const { | 155 bool ExtensionOptionsGuest::IsAutoSizeSupported() const { |
154 return true; | 156 return true; |
155 } | 157 } |
156 | 158 |
157 void ExtensionOptionsGuest::SetUpAutoSize() { | 159 void ExtensionOptionsGuest::SetUpAutoSize() { |
158 // Read the autosize parameters passed in from the embedder. | 160 // Read the autosize parameters passed in from the embedder. |
(...skipping 11 matching lines...) Expand all Loading... |
170 int min_width = 0; | 172 int min_width = 0; |
171 extra_params()->GetInteger(extensionoptions::kAttributeMinHeight, | 173 extra_params()->GetInteger(extensionoptions::kAttributeMinHeight, |
172 &min_height); | 174 &min_height); |
173 extra_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); | 175 extra_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); |
174 | 176 |
175 // Call SetAutoSize to apply all the appropriate validation and clipping of | 177 // Call SetAutoSize to apply all the appropriate validation and clipping of |
176 // values. | 178 // values. |
177 SetAutoSize( | 179 SetAutoSize( |
178 true, gfx::Size(min_width, min_height), gfx::Size(max_width, max_height)); | 180 true, gfx::Size(min_width, min_height), gfx::Size(max_width, max_height)); |
179 } | 181 } |
OLD | NEW |