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/ui/views/permission_bubble/permission_prompt_impl.h" | 5 #include "chrome/browser/ui/views/permission_bubble/permission_prompt_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 int index() const { return index_; } | 73 int index() const { return index_; } |
74 | 74 |
75 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 75 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
76 | 76 |
77 // MenuButtonListener: | 77 // MenuButtonListener: |
78 void OnMenuButtonClicked(views::MenuButton* source, | 78 void OnMenuButtonClicked(views::MenuButton* source, |
79 const gfx::Point& point, | 79 const gfx::Point& point, |
80 const ui::Event* event) override; | 80 const ui::Event* event) override; |
81 | 81 |
82 // Callback when a permission's setting is changed. | 82 // Callback when a permission's setting is changed. |
83 void PermissionChanged(const WebsiteSettingsUI::PermissionInfo& permission); | 83 void PermissionChanged(const PageInfoUI::PermissionInfo& permission); |
84 | 84 |
85 private: | 85 private: |
86 int index_; | 86 int index_; |
87 Listener* listener_; | 87 Listener* listener_; |
88 std::unique_ptr<PermissionMenuModel> model_; | 88 std::unique_ptr<PermissionMenuModel> model_; |
89 std::unique_ptr<views::MenuRunner> menu_runner_; | 89 std::unique_ptr<views::MenuRunner> menu_runner_; |
90 }; | 90 }; |
91 | 91 |
92 PermissionCombobox::PermissionCombobox(Profile* profile, | 92 PermissionCombobox::PermissionCombobox(Profile* profile, |
93 Listener* listener, | 93 Listener* listener, |
(...skipping 28 matching lines...) Expand all Loading... |
122 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::ASYNC)); | 122 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::ASYNC)); |
123 | 123 |
124 gfx::Point p(point); | 124 gfx::Point p(point); |
125 p.Offset(-source->width(), 0); | 125 p.Offset(-source->width(), 0); |
126 menu_runner_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(), this, | 126 menu_runner_->RunMenuAt(source->GetWidget()->GetTopLevelWidget(), this, |
127 gfx::Rect(p, gfx::Size()), views::MENU_ANCHOR_TOPLEFT, | 127 gfx::Rect(p, gfx::Size()), views::MENU_ANCHOR_TOPLEFT, |
128 ui::MENU_SOURCE_NONE); | 128 ui::MENU_SOURCE_NONE); |
129 } | 129 } |
130 | 130 |
131 void PermissionCombobox::PermissionChanged( | 131 void PermissionCombobox::PermissionChanged( |
132 const WebsiteSettingsUI::PermissionInfo& permission) { | 132 const PageInfoUI::PermissionInfo& permission) { |
133 SetText(model_->GetLabelAt(model_->GetIndexOfCommandId(permission.setting))); | 133 SetText(model_->GetLabelAt(model_->GetIndexOfCommandId(permission.setting))); |
134 SizeToPreferredSize(); | 134 SizeToPreferredSize(); |
135 | 135 |
136 listener_->PermissionSelectionChanged( | 136 listener_->PermissionSelectionChanged( |
137 index_, permission.setting == CONTENT_SETTING_ALLOW); | 137 index_, permission.setting == CONTENT_SETTING_ALLOW); |
138 } | 138 } |
139 | 139 |
140 /////////////////////////////////////////////////////////////////////////////// | 140 /////////////////////////////////////////////////////////////////////////////// |
141 // View implementation for the permissions bubble. | 141 // View implementation for the permissions bubble. |
142 class PermissionsBubbleDialogDelegateView | 142 class PermissionsBubbleDialogDelegateView |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 } | 491 } |
492 | 492 |
493 void PermissionPromptImpl::Deny() { | 493 void PermissionPromptImpl::Deny() { |
494 if (delegate_) | 494 if (delegate_) |
495 delegate_->Deny(); | 495 delegate_->Deny(); |
496 } | 496 } |
497 | 497 |
498 Profile* PermissionPromptImpl::GetProfile() { | 498 Profile* PermissionPromptImpl::GetProfile() { |
499 return browser_->profile(); | 499 return browser_->profile(); |
500 } | 500 } |
OLD | NEW |