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/extensions/extension_installed_bubble.h" | 5 #include "chrome/browser/ui/views/extensions/extension_installed_bubble.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/extensions/api/commands/command_service.h" | 14 #include "chrome/browser/extensions/api/commands/command_service.h" |
15 #include "chrome/browser/extensions/api/commands/command_service_factory.h" | |
16 #include "chrome/browser/extensions/extension_action.h" | 15 #include "chrome/browser/extensions/extension_action.h" |
17 #include "chrome/browser/extensions/extension_action_manager.h" | 16 #include "chrome/browser/extensions/extension_action_manager.h" |
18 #include "chrome/browser/extensions/extension_install_ui.h" | 17 #include "chrome/browser/extensions/extension_install_ui.h" |
19 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
21 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
22 #include "chrome/browser/ui/singleton_tabs.h" | 21 #include "chrome/browser/ui/singleton_tabs.h" |
23 #include "chrome/browser/ui/views/browser_action_view.h" | 22 #include "chrome/browser/ui/views/browser_action_view.h" |
24 #include "chrome/browser/ui/views/browser_actions_container.h" | 23 #include "chrome/browser/ui/views/browser_actions_container.h" |
25 #include "chrome/browser/ui/views/frame/browser_view.h" | 24 #include "chrome/browser/ui/views/frame/browser_view.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 enum Flavors { | 271 enum Flavors { |
273 NONE = 0, | 272 NONE = 0, |
274 HOW_TO_USE = 1 << 0, | 273 HOW_TO_USE = 1 << 0, |
275 HOW_TO_MANAGE = 1 << 1, | 274 HOW_TO_MANAGE = 1 << 1, |
276 SHOW_KEYBINDING = 1 << 2, | 275 SHOW_KEYBINDING = 1 << 2, |
277 SIGN_IN_PROMO = 1 << 3, | 276 SIGN_IN_PROMO = 1 << 3, |
278 }; | 277 }; |
279 | 278 |
280 bool GetKeybinding(extensions::Command* command) { | 279 bool GetKeybinding(extensions::Command* command) { |
281 extensions::CommandService* command_service = | 280 extensions::CommandService* command_service = |
282 extensions::CommandServiceFactory::GetForProfile( | 281 extensions::CommandService::Get(browser_->profile()); |
283 browser_->profile()); | |
284 if (type_ == ExtensionInstalledBubble::BROWSER_ACTION) { | 282 if (type_ == ExtensionInstalledBubble::BROWSER_ACTION) { |
285 return command_service->GetBrowserActionCommand( | 283 return command_service->GetBrowserActionCommand( |
286 extension_id_, | 284 extension_id_, |
287 extensions::CommandService::ACTIVE_ONLY, | 285 extensions::CommandService::ACTIVE_ONLY, |
288 command, | 286 command, |
289 NULL); | 287 NULL); |
290 } else if (type_ == ExtensionInstalledBubble::PAGE_ACTION) { | 288 } else if (type_ == ExtensionInstalledBubble::PAGE_ACTION) { |
291 return command_service->GetPageActionCommand( | 289 return command_service->GetPageActionCommand( |
292 extension_id_, | 290 extension_id_, |
293 extensions::CommandService::ACTIVE_ONLY, | 291 extensions::CommandService::ACTIVE_ONLY, |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 | 666 |
669 void ExtensionInstalledBubble::WindowClosing() { | 667 void ExtensionInstalledBubble::WindowClosing() { |
670 if (extension_ && type_ == PAGE_ACTION) { | 668 if (extension_ && type_ == PAGE_ACTION) { |
671 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); | 669 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); |
672 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( | 670 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( |
673 extensions::ExtensionActionManager::Get(browser_->profile())-> | 671 extensions::ExtensionActionManager::Get(browser_->profile())-> |
674 GetPageAction(*extension_), | 672 GetPageAction(*extension_), |
675 false); // preview_enabled | 673 false); // preview_enabled |
676 } | 674 } |
677 } | 675 } |
OLD | NEW |