Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: chrome/browser/ui/browser_commands.cc

Issue 489183005: Make a ShowExtensionActionPopup function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Peter's Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/browser_commands.h" 5 #include "chrome/browser/ui/browser_commands.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/app/chrome_command_ids.h" 11 #include "chrome/app/chrome_command_ids.h"
12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/browsing_data/browsing_data_helper.h" 14 #include "chrome/browser/browsing_data/browsing_data_helper.h"
15 #include "chrome/browser/browsing_data/browsing_data_remover.h" 15 #include "chrome/browser/browsing_data/browsing_data_remover.h"
16 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
17 #include "chrome/browser/chrome_page_zoom.h" 17 #include "chrome/browser/chrome_page_zoom.h"
18 #include "chrome/browser/devtools/devtools_window.h" 18 #include "chrome/browser/devtools/devtools_window.h"
19 #include "chrome/browser/dom_distiller/tab_utils.h" 19 #include "chrome/browser/dom_distiller/tab_utils.h"
20 #include "chrome/browser/extensions/api/commands/command_service.h" 20 #include "chrome/browser/extensions/api/commands/command_service.h"
21 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
21 #include "chrome/browser/extensions/tab_helper.h" 22 #include "chrome/browser/extensions/tab_helper.h"
22 #include "chrome/browser/favicon/favicon_tab_helper.h" 23 #include "chrome/browser/favicon/favicon_tab_helper.h"
23 #include "chrome/browser/lifetime/application_lifetime.h" 24 #include "chrome/browser/lifetime/application_lifetime.h"
24 #include "chrome/browser/platform_util.h" 25 #include "chrome/browser/platform_util.h"
25 #include "chrome/browser/prefs/incognito_mode_prefs.h" 26 #include "chrome/browser/prefs/incognito_mode_prefs.h"
26 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/rlz/rlz.h" 28 #include "chrome/browser/rlz/rlz.h"
28 #include "chrome/browser/search/search.h" 29 #include "chrome/browser/search/search.h"
29 #include "chrome/browser/sessions/session_service_factory.h" 30 #include "chrome/browser/sessions/session_service_factory.h"
30 #include "chrome/browser/sessions/tab_restore_service.h" 31 #include "chrome/browser/sessions/tab_restore_service.h"
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 const extensions::Extension* extension = NULL; 739 const extensions::Extension* extension = NULL;
739 extensions::Command command; 740 extensions::Command command;
740 extensions::CommandService::ExtensionCommandType command_type; 741 extensions::CommandService::ExtensionCommandType command_type;
741 if (GetBookmarkOverrideCommand(browser->profile(), 742 if (GetBookmarkOverrideCommand(browser->profile(),
742 &extension, 743 &extension,
743 &command, 744 &command,
744 &command_type)) { 745 &command_type)) {
745 switch (command_type) { 746 switch (command_type) {
746 case extensions::CommandService::NAMED: 747 case extensions::CommandService::NAMED:
747 browser->window()->ExecuteExtensionCommand(extension, command); 748 browser->window()->ExecuteExtensionCommand(extension, command);
748 return; 749 break;
749
750 case extensions::CommandService::BROWSER_ACTION: 750 case extensions::CommandService::BROWSER_ACTION:
751 case extensions::CommandService::PAGE_ACTION:
751 // BookmarkCurrentPage is called through a user gesture, so it is safe 752 // BookmarkCurrentPage is called through a user gesture, so it is safe
752 // to call ShowBrowserActionPopup. 753 // to grant the active tab permission.
753 browser->window()->ShowBrowserActionPopup(extension); 754 extensions::ExtensionActionAPI::Get(browser->profile())->
754 return; 755 ShowExtensionActionPopup(extension, browser, true);
755 756 break;
756 case extensions::CommandService::PAGE_ACTION:
757 browser->window()->ShowPageActionPopup(extension);
758 return;
759 } 757 }
758 return;
760 } 759 }
761 760
762 BookmarkCurrentPageInternal(browser); 761 BookmarkCurrentPageInternal(browser);
763 } 762 }
764 763
765 bool CanBookmarkCurrentPage(const Browser* browser) { 764 bool CanBookmarkCurrentPage(const Browser* browser) {
766 return CanBookmarkCurrentPageInternal(browser, true); 765 return CanBookmarkCurrentPageInternal(browser, true);
767 } 766 }
768 767
769 void BookmarkAllTabs(Browser* browser) { 768 void BookmarkAllTabs(Browser* browser) {
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 browser->profile(), 1280 browser->profile(),
1282 browser->host_desktop_type())); 1281 browser->host_desktop_type()));
1283 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1282 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1284 1283
1285 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1284 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1286 contents->GetRenderViewHost()->SyncRendererPrefs(); 1285 contents->GetRenderViewHost()->SyncRendererPrefs();
1287 app_browser->window()->Show(); 1286 app_browser->window()->Show();
1288 } 1287 }
1289 1288
1290 } // namespace chrome 1289 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_toolbar_model_unittest.cc ('k') | chrome/browser/ui/browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698