| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 DispatchEventToEmbedder(new GuestViewBase::Event( | 147 DispatchEventToEmbedder(new GuestViewBase::Event( |
| 148 extension_options_internal::OnSizeChanged::kEventName, args.Pass())); | 148 extension_options_internal::OnSizeChanged::kEventName, args.Pass())); |
| 149 } | 149 } |
| 150 | 150 |
| 151 bool ExtensionOptionsGuest::IsAutoSizeSupported() const { | 151 bool ExtensionOptionsGuest::IsAutoSizeSupported() const { |
| 152 return true; | 152 return true; |
| 153 } | 153 } |
| 154 | 154 |
| 155 void ExtensionOptionsGuest::SetUpAutoSize() { | 155 void ExtensionOptionsGuest::SetUpAutoSize() { |
| 156 // Read the autosize parameters passed in from the embedder. | 156 // Read the autosize parameters passed in from the embedder. |
| 157 bool auto_size_enabled; | 157 bool auto_size_enabled = false; |
| 158 extra_params()->GetBoolean(extensionoptions::kAttributeAutoSize, | 158 extra_params()->GetBoolean(extensionoptions::kAttributeAutoSize, |
| 159 &auto_size_enabled); | 159 &auto_size_enabled); |
| 160 | 160 |
| 161 int max_height = 0; | 161 int max_height = 0; |
| 162 int max_width = 0; | 162 int max_width = 0; |
| 163 extra_params()->GetInteger(extensionoptions::kAttributeMaxHeight, | 163 extra_params()->GetInteger(extensionoptions::kAttributeMaxHeight, |
| 164 &max_height); | 164 &max_height); |
| 165 extra_params()->GetInteger(extensionoptions::kAttributeMaxWidth, &max_width); | 165 extra_params()->GetInteger(extensionoptions::kAttributeMaxWidth, &max_width); |
| 166 | 166 |
| 167 int min_height = 0; | 167 int min_height = 0; |
| 168 int min_width = 0; | 168 int min_width = 0; |
| 169 extra_params()->GetInteger(extensionoptions::kAttributeMinHeight, | 169 extra_params()->GetInteger(extensionoptions::kAttributeMinHeight, |
| 170 &min_height); | 170 &min_height); |
| 171 extra_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); | 171 extra_params()->GetInteger(extensionoptions::kAttributeMinWidth, &min_width); |
| 172 | 172 |
| 173 // Call SetAutoSize to apply all the appropriate validation and clipping of | 173 // Call SetAutoSize to apply all the appropriate validation and clipping of |
| 174 // values. | 174 // values. |
| 175 SetAutoSize( | 175 SetAutoSize( |
| 176 true, gfx::Size(min_width, min_height), gfx::Size(max_width, max_height)); | 176 true, gfx::Size(min_width, min_height), gfx::Size(max_width, max_height)); |
| 177 } | 177 } |
| OLD | NEW |