| 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/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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 132 } |
| 133 | 133 |
| 134 const char* ExtensionOptionsGuest::GetAPINamespace() const { | 134 const char* ExtensionOptionsGuest::GetAPINamespace() const { |
| 135 return extensionoptions::kAPINamespace; | 135 return extensionoptions::kAPINamespace; |
| 136 } | 136 } |
| 137 | 137 |
| 138 int ExtensionOptionsGuest::GetTaskPrefix() const { | 138 int ExtensionOptionsGuest::GetTaskPrefix() const { |
| 139 return IDS_EXTENSION_TASK_MANAGER_EXTENSIONOPTIONS_TAG_PREFIX; | 139 return IDS_EXTENSION_TASK_MANAGER_EXTENSIONOPTIONS_TAG_PREFIX; |
| 140 } | 140 } |
| 141 | 141 |
| 142 void ExtensionOptionsGuest::GuestSizeChangedDueToAutoSize( | |
| 143 const gfx::Size& old_size, | |
| 144 const gfx::Size& new_size) { | |
| 145 extension_options_internal::SizeChangedOptions options; | |
| 146 options.old_width = old_size.width(); | |
| 147 options.old_height = old_size.height(); | |
| 148 options.new_width = new_size.width(); | |
| 149 options.new_height = new_size.height(); | |
| 150 DispatchEventToView(new GuestViewBase::Event( | |
| 151 extension_options_internal::OnSizeChanged::kEventName, | |
| 152 options.ToValue())); | |
| 153 } | |
| 154 | |
| 155 bool ExtensionOptionsGuest::IsAutoSizeSupported() const { | |
| 156 return true; | |
| 157 } | |
| 158 | |
| 159 bool ExtensionOptionsGuest::IsPreferredSizeModeEnabled() const { | 142 bool ExtensionOptionsGuest::IsPreferredSizeModeEnabled() const { |
| 160 return true; | 143 return true; |
| 161 } | 144 } |
| 162 | 145 |
| 163 void ExtensionOptionsGuest::OnPreferredSizeChanged(const gfx::Size& pref_size) { | 146 void ExtensionOptionsGuest::OnPreferredSizeChanged(const gfx::Size& pref_size) { |
| 164 extension_options_internal::PreferredSizeChangedOptions options; | 147 extension_options_internal::PreferredSizeChangedOptions options; |
| 165 // Convert the size from physical pixels to logical pixels. | 148 // Convert the size from physical pixels to logical pixels. |
| 166 options.width = PhysicalPixelsToLogicalPixels(pref_size.width()); | 149 options.width = PhysicalPixelsToLogicalPixels(pref_size.width()); |
| 167 options.height = PhysicalPixelsToLogicalPixels(pref_size.height()); | 150 options.height = PhysicalPixelsToLogicalPixels(pref_size.height()); |
| 168 DispatchEventToView(new GuestViewBase::Event( | 151 DispatchEventToView(new GuestViewBase::Event( |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 return handled; | 239 return handled; |
| 257 } | 240 } |
| 258 | 241 |
| 259 void ExtensionOptionsGuest::OnRequest( | 242 void ExtensionOptionsGuest::OnRequest( |
| 260 const ExtensionHostMsg_Request_Params& params) { | 243 const ExtensionHostMsg_Request_Params& params) { |
| 261 extension_function_dispatcher_->Dispatch(params, | 244 extension_function_dispatcher_->Dispatch(params, |
| 262 web_contents()->GetRenderViewHost()); | 245 web_contents()->GetRenderViewHost()); |
| 263 } | 246 } |
| 264 | 247 |
| 265 } // namespace extensions | 248 } // namespace extensions |
| OLD | NEW |