| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/website_settings/permission_selector_view.h" | 5 #include "chrome/browser/ui/views/website_settings/permission_selector_view.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | 8 #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
| 9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 // Update the icon to reflect the new setting. | 313 // Update the icon to reflect the new setting. |
| 314 ContentSetting effective_setting = menu_button_model_->current_setting(); | 314 ContentSetting effective_setting = menu_button_model_->current_setting(); |
| 315 if (effective_setting == CONTENT_SETTING_DEFAULT) | 315 if (effective_setting == CONTENT_SETTING_DEFAULT) |
| 316 effective_setting = menu_button_model_->default_setting(); | 316 effective_setting = menu_button_model_->default_setting(); |
| 317 const gfx::Image& image = WebsiteSettingsUI::GetPermissionIcon( | 317 const gfx::Image& image = WebsiteSettingsUI::GetPermissionIcon( |
| 318 menu_button_model_->site_permission(), effective_setting); | 318 menu_button_model_->site_permission(), effective_setting); |
| 319 icon_->SetImage(image.ToImageSkia()); | 319 icon_->SetImage(image.ToImageSkia()); |
| 320 | 320 |
| 321 // Update the menu button text to reflect the new setting. | 321 // Update the menu button text to reflect the new setting. |
| 322 menu_button_->SetText(WebsiteSettingsUI::PermissionActionToUIString( | 322 menu_button_->SetText(WebsiteSettingsUI::PermissionActionToUIString( |
| 323 menu_button_model_->current_setting(), | 323 menu_button_model_->current_setting(), |
| 324 menu_button_model_->default_setting(), | 324 menu_button_model_->default_setting(), |
| 325 content_settings::SETTING_SOURCE_USER)); | 325 content_settings::SETTING_SOURCE_USER)); |
| 326 | |
| 327 | 326 |
| 328 FOR_EACH_OBSERVER(PermissionSelectorViewObserver, | 327 FOR_EACH_OBSERVER(PermissionSelectorViewObserver, |
| 329 observer_list_, | 328 observer_list_, |
| 330 OnPermissionChanged(this)); | 329 OnPermissionChanged(this)); |
| 331 } | 330 } |
| 332 | 331 |
| 333 ContentSetting PermissionSelectorView::GetSelectedSetting() const { | 332 ContentSetting PermissionSelectorView::GetSelectedSetting() const { |
| 334 return menu_button_model_->current_setting(); | 333 return menu_button_model_->current_setting(); |
| 335 } | 334 } |
| 336 | 335 |
| 337 ContentSettingsType PermissionSelectorView::GetPermissionType() const { | 336 ContentSettingsType PermissionSelectorView::GetPermissionType() const { |
| 338 return menu_button_model_->site_permission(); | 337 return menu_button_model_->site_permission(); |
| 339 } | 338 } |
| 340 | 339 |
| 341 void PermissionSelectorView::ChildPreferredSizeChanged(View* child) { | 340 void PermissionSelectorView::ChildPreferredSizeChanged(View* child) { |
| 342 SizeToPreferredSize(); | 341 SizeToPreferredSize(); |
| 343 // FIXME: The parent is only a plain |View| that is used as a | 342 // FIXME: The parent is only a plain |View| that is used as a |
| 344 // container/box/panel. The SizeToPreferredSize method of the parent is | 343 // container/box/panel. The SizeToPreferredSize method of the parent is |
| 345 // called here directly in order not to implement a custom |View| class with | 344 // called here directly in order not to implement a custom |View| class with |
| 346 // its own implementation of the ChildPreferredSizeChanged method. | 345 // its own implementation of the ChildPreferredSizeChanged method. |
| 347 parent()->SizeToPreferredSize(); | 346 parent()->SizeToPreferredSize(); |
| 348 } | 347 } |
| 349 | 348 |
| 350 PermissionSelectorView::~PermissionSelectorView() { | 349 PermissionSelectorView::~PermissionSelectorView() { |
| 351 } | 350 } |
| OLD | NEW |