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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc

Issue 6893046: added CTRL+Click and SHIFT+Click handler for context menu, Back and Forward. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: make this patch applicable to the latest trunk Created 9 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/bookmarks/bookmark_bar_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/bookmarks/bookmark_model.h" 16 #include "chrome/browser/bookmarks/bookmark_model.h"
17 #include "chrome/browser/bookmarks/bookmark_utils.h" 17 #include "chrome/browser/bookmarks/bookmark_utils.h"
18 #include "chrome/browser/browser_shutdown.h" 18 #include "chrome/browser/browser_shutdown.h"
19 #include "chrome/browser/defaults.h" 19 #include "chrome/browser/defaults.h"
20 #include "chrome/browser/event_disposition.h"
20 #include "chrome/browser/extensions/extension_service.h" 21 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/prefs/pref_service.h" 22 #include "chrome/browser/prefs/pref_service.h"
22 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/sync/sync_ui_util.h" 24 #include "chrome/browser/sync/sync_ui_util.h"
24 #include "chrome/browser/themes/theme_service.h" 25 #include "chrome/browser/themes/theme_service.h"
25 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" 26 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
26 #include "chrome/browser/ui/browser.h" 27 #include "chrome/browser/ui/browser.h"
27 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
28 #include "chrome/browser/ui/view_ids.h" 29 #include "chrome/browser/ui/view_ids.h"
29 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h" 30 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 197 }
197 198
198 virtual bool IsTriggerableEvent(const views::MouseEvent& e) OVERRIDE { 199 virtual bool IsTriggerableEvent(const views::MouseEvent& e) OVERRIDE {
199 // Left clicks should show the menu contents and right clicks should show 200 // Left clicks should show the menu contents and right clicks should show
200 // the context menu. They should not trigger the opening of underlying urls. 201 // the context menu. They should not trigger the opening of underlying urls.
201 if (e.flags() == ui::EF_LEFT_BUTTON_DOWN || 202 if (e.flags() == ui::EF_LEFT_BUTTON_DOWN ||
202 e.flags() == ui::EF_RIGHT_BUTTON_DOWN) 203 e.flags() == ui::EF_RIGHT_BUTTON_DOWN)
203 return false; 204 return false;
204 205
205 WindowOpenDisposition disposition( 206 WindowOpenDisposition disposition(
206 event_utils::DispositionFromEventFlags(e.flags())); 207 browser::DispositionFromEventFlags(e.flags()));
207 return disposition != CURRENT_TAB; 208 return disposition != CURRENT_TAB;
208 } 209 }
209 210
210 virtual void OnPaint(gfx::Canvas* canvas) { 211 virtual void OnPaint(gfx::Canvas* canvas) {
211 views::MenuButton::PaintButton(canvas, views::MenuButton::PB_NORMAL); 212 views::MenuButton::PaintButton(canvas, views::MenuButton::PB_NORMAL);
212 } 213 }
213 214
214 private: 215 private:
215 scoped_ptr<ui::SlideAnimation> show_animation_; 216 scoped_ptr<ui::SlideAnimation> show_animation_;
216 217
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 if (sender->tag() == kOtherFolderButtonTag) { 1081 if (sender->tag() == kOtherFolderButtonTag) {
1081 node = model_->other_node(); 1082 node = model_->other_node();
1082 } else { 1083 } else {
1083 int index = GetIndexOf(sender); 1084 int index = GetIndexOf(sender);
1084 DCHECK_NE(-1, index); 1085 DCHECK_NE(-1, index);
1085 node = model_->GetBookmarkBarNode()->GetChild(index); 1086 node = model_->GetBookmarkBarNode()->GetChild(index);
1086 } 1087 }
1087 DCHECK(page_navigator_); 1088 DCHECK(page_navigator_);
1088 1089
1089 WindowOpenDisposition disposition_from_event_flags = 1090 WindowOpenDisposition disposition_from_event_flags =
1090 event_utils::DispositionFromEventFlags(sender->mouse_event_flags()); 1091 browser::DispositionFromEventFlags(sender->mouse_event_flags());
1091 1092
1092 if (node->is_url()) { 1093 if (node->is_url()) {
1093 RecordAppLaunch(profile_, node->GetURL()); 1094 RecordAppLaunch(profile_, node->GetURL());
1094 page_navigator_->OpenURL(node->GetURL(), GURL(), 1095 page_navigator_->OpenURL(node->GetURL(), GURL(),
1095 disposition_from_event_flags, PageTransition::AUTO_BOOKMARK); 1096 disposition_from_event_flags, PageTransition::AUTO_BOOKMARK);
1096 } else { 1097 } else {
1097 bookmark_utils::OpenAll(GetWidget()->GetNativeWindow(), profile_, 1098 bookmark_utils::OpenAll(GetWidget()->GetNativeWindow(), profile_,
1098 page_navigator_, node, disposition_from_event_flags); 1099 page_navigator_, node, disposition_from_event_flags);
1099 } 1100 }
1100 UserMetrics::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton")); 1101 UserMetrics::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton"));
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 (1 - size_animation_->GetCurrentValue()))); 1758 (1 - size_animation_->GetCurrentValue())));
1758 } else { 1759 } else {
1759 prefsize.set_height( 1760 prefsize.set_height(
1760 static_cast<int>( 1761 static_cast<int>(
1761 browser_defaults::kBookmarkBarHeight * 1762 browser_defaults::kBookmarkBarHeight *
1762 size_animation_->GetCurrentValue())); 1763 size_animation_->GetCurrentValue()));
1763 } 1764 }
1764 } 1765 }
1765 return prefsize; 1766 return prefsize;
1766 } 1767 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/back_forward_menu_model.cc ('k') | chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698