| 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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/website_settings/permission_menu_model.h" | 8 #include "chrome/browser/ui/website_settings/permission_menu_model.h" |
| 9 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | 9 #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
| 10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 SetTextColor(views::Button::STATE_NORMAL, GetNativeTheme()->GetSystemColor( | 91 SetTextColor(views::Button::STATE_NORMAL, GetNativeTheme()->GetSystemColor( |
| 92 ui::NativeTheme::kColorId_LabelEnabledColor)); | 92 ui::NativeTheme::kColorId_LabelEnabledColor)); |
| 93 SetTextColor(views::Button::STATE_HOVERED, GetNativeTheme()->GetSystemColor( | 93 SetTextColor(views::Button::STATE_HOVERED, GetNativeTheme()->GetSystemColor( |
| 94 ui::NativeTheme::kColorId_LabelEnabledColor)); | 94 ui::NativeTheme::kColorId_LabelEnabledColor)); |
| 95 SetTextColor(views::Button::STATE_DISABLED, GetNativeTheme()->GetSystemColor( | 95 SetTextColor(views::Button::STATE_DISABLED, GetNativeTheme()->GetSystemColor( |
| 96 ui::NativeTheme::kColorId_LabelDisabledColor)); | 96 ui::NativeTheme::kColorId_LabelDisabledColor)); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void PermissionMenuButton::OnMenuButtonClicked(View* source, | 99 void PermissionMenuButton::OnMenuButtonClicked(View* source, |
| 100 const gfx::Point& point) { | 100 const gfx::Point& point) { |
| 101 menu_runner_.reset(new views::MenuRunner(menu_model_)); | 101 menu_runner_.reset( |
| 102 new views::MenuRunner(menu_model_, views::MenuRunner::HAS_MNEMONICS)); |
| 102 | 103 |
| 103 gfx::Point p(point); | 104 gfx::Point p(point); |
| 104 p.Offset(-source->width(), 0); | 105 p.Offset(-source->width(), 0); |
| 105 if (menu_runner_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(), | 106 if (menu_runner_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(), |
| 106 this, | 107 this, |
| 107 gfx::Rect(p, gfx::Size()), | 108 gfx::Rect(p, gfx::Size()), |
| 108 views::MENU_ANCHOR_TOPLEFT, | 109 views::MENU_ANCHOR_TOPLEFT, |
| 109 ui::MENU_SOURCE_NONE, | 110 ui::MENU_SOURCE_NONE) == |
| 110 views::MenuRunner::HAS_MNEMONICS) == | |
| 111 views::MenuRunner::MENU_DELETED) { | 111 views::MenuRunner::MENU_DELETED) { |
| 112 return; | 112 return; |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace internal | 116 } // namespace internal |
| 117 | 117 |
| 118 /////////////////////////////////////////////////////////////////////////////// | 118 /////////////////////////////////////////////////////////////////////////////// |
| 119 // PermissionSelectorView | 119 // PermissionSelectorView |
| 120 /////////////////////////////////////////////////////////////////////////////// | 120 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // Update the menu button text to reflect the new setting. | 213 // Update the menu button text to reflect the new setting. |
| 214 menu_button_->SetText(WebsiteSettingsUI::PermissionActionToUIString( | 214 menu_button_->SetText(WebsiteSettingsUI::PermissionActionToUIString( |
| 215 permission.setting, | 215 permission.setting, |
| 216 permission.default_setting, | 216 permission.default_setting, |
| 217 content_settings::SETTING_SOURCE_USER)); | 217 content_settings::SETTING_SOURCE_USER)); |
| 218 | 218 |
| 219 FOR_EACH_OBSERVER(PermissionSelectorViewObserver, | 219 FOR_EACH_OBSERVER(PermissionSelectorViewObserver, |
| 220 observer_list_, | 220 observer_list_, |
| 221 OnPermissionChanged(permission)); | 221 OnPermissionChanged(permission)); |
| 222 } | 222 } |
| OLD | NEW |