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/page_info/permission_selector_row.h" | 5 #include "chrome/browser/ui/views/page_info/permission_selector_row.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/ui/page_info/page_info_ui.h" | 10 #include "chrome/browser/ui/page_info/page_info_ui.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 views::Button::STATE_HOVERED, | 102 views::Button::STATE_HOVERED, |
103 theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor)); | 103 theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor)); |
104 SetTextColor( | 104 SetTextColor( |
105 views::Button::STATE_DISABLED, | 105 views::Button::STATE_DISABLED, |
106 theme->GetSystemColor(ui::NativeTheme::kColorId_LabelDisabledColor)); | 106 theme->GetSystemColor(ui::NativeTheme::kColorId_LabelDisabledColor)); |
107 } | 107 } |
108 | 108 |
109 void PermissionMenuButton::OnMenuButtonClicked(views::MenuButton* source, | 109 void PermissionMenuButton::OnMenuButtonClicked(views::MenuButton* source, |
110 const gfx::Point& point, | 110 const gfx::Point& point, |
111 const ui::Event* event) { | 111 const ui::Event* event) { |
112 menu_runner_.reset(new views::MenuRunner( | 112 menu_runner_.reset( |
113 menu_model_, | 113 new views::MenuRunner(menu_model_, views::MenuRunner::HAS_MNEMONICS)); |
114 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::ASYNC)); | |
115 | 114 |
116 gfx::Point p(point); | 115 gfx::Point p(point); |
117 p.Offset(is_rtl_display_ ? source->width() : -source->width(), 0); | 116 p.Offset(is_rtl_display_ ? source->width() : -source->width(), 0); |
118 menu_runner_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(), this, | 117 menu_runner_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(), this, |
119 gfx::Rect(p, gfx::Size()), views::MENU_ANCHOR_TOPLEFT, | 118 gfx::Rect(p, gfx::Size()), views::MENU_ANCHOR_TOPLEFT, |
120 ui::MENU_SOURCE_NONE); | 119 ui::MENU_SOURCE_NONE); |
121 } | 120 } |
122 | 121 |
123 // This class adapts a |PermissionMenuModel| into a |ui::ComboboxModel| so that | 122 // This class adapts a |PermissionMenuModel| into a |ui::ComboboxModel| so that |
124 // |PermissionCombobox| can use it. | 123 // |PermissionCombobox| can use it. |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 observer.OnPermissionChanged(permission); | 359 observer.OnPermissionChanged(permission); |
361 } | 360 } |
362 | 361 |
363 views::View* PermissionSelectorRow::button() { | 362 views::View* PermissionSelectorRow::button() { |
364 // These casts are required because the two arms of a ?: cannot have different | 363 // These casts are required because the two arms of a ?: cannot have different |
365 // types T1 and T2, even if the resulting value of the ?: is about to be a T | 364 // types T1 and T2, even if the resulting value of the ?: is about to be a T |
366 // and T1 and T2 are both subtypes of T. | 365 // and T1 and T2 are both subtypes of T. |
367 return menu_button_ ? static_cast<views::View*>(menu_button_) | 366 return menu_button_ ? static_cast<views::View*>(menu_button_) |
368 : static_cast<views::View*>(combobox_); | 367 : static_cast<views::View*>(combobox_); |
369 } | 368 } |
OLD | NEW |