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/extensions/extension_action_view_controller.h" | 5 #include "chrome/browser/ui/views/extensions/extension_action_view_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/extensions/api/commands/command_service.h" | 8 #include "chrome/browser/extensions/api/commands/command_service.h" |
9 #include "chrome/browser/extensions/extension_action.h" | 9 #include "chrome/browser/extensions/extension_action.h" |
10 #include "chrome/browser/extensions/extension_toolbar_model.h" | 10 #include "chrome/browser/extensions/extension_toolbar_model.h" |
11 #include "chrome/browser/extensions/location_bar_controller.h" | 11 #include "chrome/browser/extensions/location_bar_controller.h" |
12 #include "chrome/browser/extensions/tab_helper.h" | 12 #include "chrome/browser/extensions/tab_helper.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/sessions/session_id.h" | 14 #include "chrome/browser/sessions/session_tab_helper.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/extensions/accelerator_priority.h" | 16 #include "chrome/browser/ui/extensions/accelerator_priority.h" |
17 #include "chrome/browser/ui/views/extensions/extension_action_view_delegate.h" | 17 #include "chrome/browser/ui/views/extensions/extension_action_view_delegate.h" |
18 #include "chrome/common/extensions/api/extension_action/action_info.h" | 18 #include "chrome/common/extensions/api/extension_action/action_info.h" |
19 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
20 #include "extensions/common/manifest_constants.h" | 20 #include "extensions/common/manifest_constants.h" |
21 #include "ui/views/controls/menu/menu_controller.h" | 21 #include "ui/views/controls/menu/menu_controller.h" |
22 #include "ui/views/controls/menu/menu_runner.h" | 22 #include "ui/views/controls/menu/menu_runner.h" |
23 #include "ui/views/view.h" | 23 #include "ui/views/view.h" |
24 #include "ui/views/widget/widget.h" | 24 #include "ui/views/widget/widget.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 if (popup_) | 108 if (popup_) |
109 CleanupPopup(true); | 109 CleanupPopup(true); |
110 } | 110 } |
111 | 111 |
112 gfx::Image ExtensionActionViewController::GetIcon(int tab_id) { | 112 gfx::Image ExtensionActionViewController::GetIcon(int tab_id) { |
113 return icon_factory_.GetIcon(tab_id); | 113 return icon_factory_.GetIcon(tab_id); |
114 } | 114 } |
115 | 115 |
116 int ExtensionActionViewController::GetCurrentTabId() const { | 116 int ExtensionActionViewController::GetCurrentTabId() const { |
117 content::WebContents* web_contents = delegate_->GetCurrentWebContents(); | 117 content::WebContents* web_contents = delegate_->GetCurrentWebContents(); |
118 return web_contents ? SessionID::IdForTab(web_contents) : -1; | 118 return web_contents ? SessionTabHelper::IdForTab(web_contents) : -1; |
119 } | 119 } |
120 | 120 |
121 void ExtensionActionViewController::RegisterCommand() { | 121 void ExtensionActionViewController::RegisterCommand() { |
122 // If we've already registered, do nothing. | 122 // If we've already registered, do nothing. |
123 if (action_keybinding_.get()) | 123 if (action_keybinding_.get()) |
124 return; | 124 return; |
125 | 125 |
126 extensions::Command extension_command; | 126 extensions::Command extension_command; |
127 views::FocusManager* focus_manager = | 127 views::FocusManager* focus_manager = |
128 delegate_->GetFocusManagerForAccelerator(); | 128 delegate_->GetFocusManagerForAccelerator(); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 } | 329 } |
330 | 330 |
331 void ExtensionActionViewController::CleanupPopup(bool close_widget) { | 331 void ExtensionActionViewController::CleanupPopup(bool close_widget) { |
332 DCHECK(popup_); | 332 DCHECK(popup_); |
333 delegate_->CleanupPopup(); | 333 delegate_->CleanupPopup(); |
334 popup_->GetWidget()->RemoveObserver(this); | 334 popup_->GetWidget()->RemoveObserver(this); |
335 if (close_widget) | 335 if (close_widget) |
336 popup_->GetWidget()->Close(); | 336 popup_->GetWidget()->Close(); |
337 popup_ = NULL; | 337 popup_ = NULL; |
338 } | 338 } |
OLD | NEW |