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

Unified Diff: chrome/browser/ui/browser_commands.cc

Issue 765043002: Bookmark pop-up doesn't open if Ctrl+D is set as keyboard shortcut for added extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing nit. Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser_commands.h ('k') | chrome/browser/ui/views/location_bar/bubble_icon_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_commands.cc
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index d35e8664a597583b05d76ab53e338e6f8e09975f..6e54930b22cd53168ea8eb1b101d597ef79b9a58 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -167,38 +167,6 @@ bool GetBookmarkOverrideCommand(
}
#endif
-void BookmarkCurrentPageInternal(Browser* browser) {
- content::RecordAction(UserMetricsAction("Star"));
-
- BookmarkModel* model =
- BookmarkModelFactory::GetForProfile(browser->profile());
- if (!model || !model->loaded())
- return; // Ignore requests until bookmarks are loaded.
-
- GURL url;
- base::string16 title;
- WebContents* web_contents =
- browser->tab_strip_model()->GetActiveWebContents();
- GetURLAndTitleToBookmark(web_contents, &url, &title);
- bool is_bookmarked_by_any = model->IsBookmarked(url);
- if (!is_bookmarked_by_any &&
- web_contents->GetBrowserContext()->IsOffTheRecord()) {
- // If we're incognito the favicon may not have been saved. Save it now
- // so that bookmarks have an icon for the page.
- FaviconTabHelper::FromWebContents(web_contents)->SaveFavicon();
- }
- bool was_bookmarked_by_user = bookmarks::IsBookmarkedByUser(model, url);
- bookmarks::AddIfNotBookmarked(model, url, title);
- bool is_bookmarked_by_user = bookmarks::IsBookmarkedByUser(model, url);
- // Make sure the model actually added a bookmark before showing the star. A
- // bookmark isn't created if the url is invalid.
- if (browser->window()->IsActive() && is_bookmarked_by_user) {
- // Only show the bubble if the window is active, otherwise we may get into
- // weird situations where the bubble is deleted as soon as it is shown.
- browser->window()->ShowBookmarkBubble(url, was_bookmarked_by_user);
- }
-}
-
// Based on |disposition|, creates a new tab as necessary, and returns the
// appropriate tab to navigate. If that tab is the current tab, reverts the
// location bar contents, since all browser-UI-triggered navigations should
@@ -744,7 +712,39 @@ void Exit() {
chrome::AttemptUserExit();
}
-void BookmarkCurrentPage(Browser* browser) {
+void BookmarkCurrentPageIgnoringExtensionOverrides(Browser* browser) {
+ content::RecordAction(UserMetricsAction("Star"));
+
+ BookmarkModel* model =
+ BookmarkModelFactory::GetForProfile(browser->profile());
+ if (!model || !model->loaded())
+ return; // Ignore requests until bookmarks are loaded.
+
+ GURL url;
+ base::string16 title;
+ WebContents* web_contents =
+ browser->tab_strip_model()->GetActiveWebContents();
+ GetURLAndTitleToBookmark(web_contents, &url, &title);
+ bool is_bookmarked_by_any = model->IsBookmarked(url);
+ if (!is_bookmarked_by_any &&
+ web_contents->GetBrowserContext()->IsOffTheRecord()) {
+ // If we're incognito the favicon may not have been saved. Save it now
+ // so that bookmarks have an icon for the page.
+ FaviconTabHelper::FromWebContents(web_contents)->SaveFavicon();
+ }
+ bool was_bookmarked_by_user = bookmarks::IsBookmarkedByUser(model, url);
+ bookmarks::AddIfNotBookmarked(model, url, title);
+ bool is_bookmarked_by_user = bookmarks::IsBookmarkedByUser(model, url);
+ // Make sure the model actually added a bookmark before showing the star. A
+ // bookmark isn't created if the url is invalid.
+ if (browser->window()->IsActive() && is_bookmarked_by_user) {
+ // Only show the bubble if the window is active, otherwise we may get into
+ // weird situations where the bubble is deleted as soon as it is shown.
+ browser->window()->ShowBookmarkBubble(url, was_bookmarked_by_user);
+ }
+}
+
+void BookmarkCurrentPageAllowingExtensionOverrides(Browser* browser) {
DCHECK(!chrome::ShouldRemoveBookmarkThisPageUI(browser->profile()));
#if defined(ENABLE_EXTENSIONS)
@@ -770,8 +770,7 @@ void BookmarkCurrentPage(Browser* browser) {
return;
}
#endif
-
- BookmarkCurrentPageInternal(browser);
+ BookmarkCurrentPageIgnoringExtensionOverrides(browser);
}
bool CanBookmarkCurrentPage(const Browser* browser) {
« no previous file with comments | « chrome/browser/ui/browser_commands.h ('k') | chrome/browser/ui/views/location_bar/bubble_icon_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698