| 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/accessibility/accessible_view_state.h" | 10 #include "ui/base/accessibility/accessible_view_state.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace internal | 146 } // namespace internal |
| 147 | 147 |
| 148 /////////////////////////////////////////////////////////////////////////////// | 148 /////////////////////////////////////////////////////////////////////////////// |
| 149 // PermissionSelectorView | 149 // PermissionSelectorView |
| 150 /////////////////////////////////////////////////////////////////////////////// | 150 /////////////////////////////////////////////////////////////////////////////// |
| 151 | 151 |
| 152 PermissionSelectorView::PermissionSelectorView( | 152 PermissionSelectorView::PermissionSelectorView( |
| 153 const GURL& url, |
| 153 ContentSettingsType type, | 154 ContentSettingsType type, |
| 154 ContentSetting default_setting, | 155 ContentSetting default_setting, |
| 155 ContentSetting current_setting, | 156 ContentSetting current_setting, |
| 156 content_settings::SettingSource source) | 157 content_settings::SettingSource source) |
| 157 : icon_(NULL), | 158 : icon_(NULL), |
| 158 menu_button_(NULL), | 159 menu_button_(NULL), |
| 159 type_(type), | 160 type_(type), |
| 160 default_setting_(default_setting), | 161 default_setting_(default_setting), |
| 161 current_setting_(current_setting) { | 162 current_setting_(current_setting) { |
| 162 views::GridLayout* layout = new views::GridLayout(this); | 163 views::GridLayout* layout = new views::GridLayout(this); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 l10n_util::GetStringFUTF16( | 202 l10n_util::GetStringFUTF16( |
| 202 IDS_WEBSITE_SETTINGS_PERMISSION_TYPE, | 203 IDS_WEBSITE_SETTINGS_PERMISSION_TYPE, |
| 203 WebsiteSettingsUI::PermissionTypeToUIString(type))); | 204 WebsiteSettingsUI::PermissionTypeToUIString(type))); |
| 204 layout->AddView(label, | 205 layout->AddView(label, |
| 205 1, | 206 1, |
| 206 1, | 207 1, |
| 207 views::GridLayout::LEADING, | 208 views::GridLayout::LEADING, |
| 208 views::GridLayout::CENTER); | 209 views::GridLayout::CENTER); |
| 209 // Create the permission menu button. | 210 // Create the permission menu button. |
| 210 menu_button_model_.reset(new PermissionMenuModel( | 211 menu_button_model_.reset(new PermissionMenuModel( |
| 211 this, type, default_setting, current_setting)); | 212 this, url, type, default_setting, current_setting)); |
| 212 bool button_enabled = source == content_settings::SETTING_SOURCE_USER; | 213 bool button_enabled = source == content_settings::SETTING_SOURCE_USER; |
| 213 menu_button_ = new internal::PermissionMenuButton( | 214 menu_button_ = new internal::PermissionMenuButton( |
| 214 WebsiteSettingsUI::PermissionActionToUIString(current_setting, | 215 WebsiteSettingsUI::PermissionActionToUIString(current_setting, |
| 215 default_setting, | 216 default_setting, |
| 216 source), | 217 source), |
| 217 menu_button_model_.get(), | 218 menu_button_model_.get(), |
| 218 button_enabled); | 219 button_enabled); |
| 219 menu_button_->SetEnabled(button_enabled); | 220 menu_button_->SetEnabled(button_enabled); |
| 220 menu_button_->set_focusable(button_enabled); | 221 menu_button_->set_focusable(button_enabled); |
| 221 menu_button_->SetAccessibleName( | 222 menu_button_->SetAccessibleName( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 content_settings::SETTING_SOURCE_USER)); | 259 content_settings::SETTING_SOURCE_USER)); |
| 259 | 260 |
| 260 FOR_EACH_OBSERVER(PermissionSelectorViewObserver, | 261 FOR_EACH_OBSERVER(PermissionSelectorViewObserver, |
| 261 observer_list_, | 262 observer_list_, |
| 262 OnPermissionChanged(this)); | 263 OnPermissionChanged(this)); |
| 263 } | 264 } |
| 264 | 265 |
| 265 bool PermissionSelectorView::IsCommandIdChecked(int command_id) { | 266 bool PermissionSelectorView::IsCommandIdChecked(int command_id) { |
| 266 return current_setting_ == CommandIdToContentSetting(command_id); | 267 return current_setting_ == CommandIdToContentSetting(command_id); |
| 267 } | 268 } |
| OLD | NEW |