OLD | NEW |
---|---|
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" |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
741 chrome::AttemptUserExit(); | 741 chrome::AttemptUserExit(); |
742 } | 742 } |
743 | 743 |
744 void BookmarkCurrentPage(Browser* browser) { | 744 void BookmarkCurrentPage(Browser* browser) { |
745 DCHECK(!chrome::ShouldRemoveBookmarkThisPageUI(browser->profile())); | 745 DCHECK(!chrome::ShouldRemoveBookmarkThisPageUI(browser->profile())); |
746 | 746 |
747 #if defined(ENABLE_EXTENSIONS) | 747 #if defined(ENABLE_EXTENSIONS) |
748 const extensions::Extension* extension = NULL; | 748 const extensions::Extension* extension = NULL; |
749 extensions::Command command; | 749 extensions::Command command; |
750 extensions::CommandService::ExtensionCommandType command_type; | 750 extensions::CommandService::ExtensionCommandType command_type; |
751 if (GetBookmarkOverrideCommand(browser->profile(), | 751 |
752 &extension, | 752 // Bookmark command override for extensions will not be considered when user |
753 &command, | 753 // selects bookmark icon for bookmarking a page by mouse. |
754 &command_type)) { | 754 if (GetBookmarkOverrideCommand(browser->profile(), &extension, &command, |
755 &command_type) && | |
756 !browser->command_controller() | |
757 ->command_updater() | |
758 ->get_bookmark_icon_selected()) { | |
Finnur
2014/12/03 10:49:17
Mike Wittman implemented the Ctrl+D override for e
| |
755 switch (command_type) { | 759 switch (command_type) { |
756 case extensions::CommandService::NAMED: | 760 case extensions::CommandService::NAMED: |
757 browser->window()->ExecuteExtensionCommand(extension, command); | 761 browser->window()->ExecuteExtensionCommand(extension, command); |
758 break; | 762 break; |
759 case extensions::CommandService::BROWSER_ACTION: | 763 case extensions::CommandService::BROWSER_ACTION: |
760 case extensions::CommandService::PAGE_ACTION: | 764 case extensions::CommandService::PAGE_ACTION: |
761 // BookmarkCurrentPage is called through a user gesture, so it is safe | 765 // BookmarkCurrentPage is called through a user gesture, so it is safe |
762 // to grant the active tab permission. | 766 // to grant the active tab permission. |
763 extensions::ExtensionActionAPI::Get(browser->profile())-> | 767 extensions::ExtensionActionAPI::Get(browser->profile())-> |
764 ShowExtensionActionPopup(extension, browser, true); | 768 ShowExtensionActionPopup(extension, browser, true); |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1267 browser->host_desktop_type())); | 1271 browser->host_desktop_type())); |
1268 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1272 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1269 | 1273 |
1270 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1274 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1271 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1275 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1272 app_browser->window()->Show(); | 1276 app_browser->window()->Show(); |
1273 } | 1277 } |
1274 #endif // defined(ENABLE_EXTENSIONS) | 1278 #endif // defined(ENABLE_EXTENSIONS) |
1275 | 1279 |
1276 } // namespace chrome | 1280 } // namespace chrome |
OLD | NEW |