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

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

Issue 9665008: views: Nuke is_mouse_gesture parameter from ContextMenuController::ShowContextMenuForView(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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) 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/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>
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 } 793 }
794 const BookmarkNodeData data = drop_info_->data; 794 const BookmarkNodeData data = drop_info_->data;
795 DCHECK(data.is_valid()); 795 DCHECK(data.is_valid());
796 drop_info_.reset(); 796 drop_info_.reset();
797 return bookmark_utils::PerformBookmarkDrop(browser_->profile(), data, 797 return bookmark_utils::PerformBookmarkDrop(browser_->profile(), data,
798 parent_node, index); 798 parent_node, index);
799 } 799 }
800 800
801 void BookmarkBarView::ShowContextMenu(const gfx::Point& p, 801 void BookmarkBarView::ShowContextMenu(const gfx::Point& p,
802 bool is_mouse_gesture) { 802 bool is_mouse_gesture) {
803 ShowContextMenuForView(this, p, is_mouse_gesture); 803 views::GestureType type = is_mouse_gesture ? views::GESTURE_TYPE_USER
804 : views::GESTURE_TYPE_API;
805 ShowContextMenuForView(this, p, type);
804 } 806 }
805 807
806 void BookmarkBarView::OnThemeChanged() { 808 void BookmarkBarView::OnThemeChanged() {
807 UpdateColors(); 809 UpdateColors();
808 } 810 }
809 811
810 std::string BookmarkBarView::GetClassName() const { 812 std::string BookmarkBarView::GetClassName() const {
811 return kViewClassName; 813 return kViewClassName;
812 } 814 }
813 815
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 bookmark_utils::OpenAll(GetWidget()->GetNativeWindow(), profile, 1044 bookmark_utils::OpenAll(GetWidget()->GetNativeWindow(), profile,
1043 page_navigator_, node, disposition_from_event_flags); 1045 page_navigator_, node, disposition_from_event_flags);
1044 } 1046 }
1045 1047
1046 bookmark_utils::RecordBookmarkLaunch(IsDetached() ? 1048 bookmark_utils::RecordBookmarkLaunch(IsDetached() ?
1047 bookmark_utils::LAUNCH_DETACHED_BAR : 1049 bookmark_utils::LAUNCH_DETACHED_BAR :
1048 bookmark_utils::LAUNCH_ATTACHED_BAR); 1050 bookmark_utils::LAUNCH_ATTACHED_BAR);
1049 content::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton")); 1051 content::RecordAction(UserMetricsAction("ClickedBookmarkBarURLButton"));
1050 } 1052 }
1051 1053
1052 void BookmarkBarView::ShowContextMenuForView(View* source, 1054 void BookmarkBarView::ShowContextMenuForView(views::View* source,
1053 const gfx::Point& p, 1055 const gfx::Point& point,
1054 bool is_mouse_gesture) { 1056 views::GestureType gesture_type) {
1055 if (!model_->IsLoaded()) { 1057 if (!model_->IsLoaded()) {
1056 // Don't do anything if the model isn't loaded. 1058 // Don't do anything if the model isn't loaded.
1057 return; 1059 return;
1058 } 1060 }
1059 1061
1060 const BookmarkNode* parent = NULL; 1062 const BookmarkNode* parent = NULL;
1061 std::vector<const BookmarkNode*> nodes; 1063 std::vector<const BookmarkNode*> nodes;
1062 if (source == other_bookmarked_button_) { 1064 if (source == other_bookmarked_button_) {
1063 parent = model_->other_node(); 1065 parent = model_->other_node();
1064 // Do this so the user can open all bookmarks. BookmarkContextMenu makes 1066 // Do this so the user can open all bookmarks. BookmarkContextMenu makes
(...skipping 12 matching lines...) Expand all
1077 } else { 1079 } else {
1078 parent = model_->bookmark_bar_node(); 1080 parent = model_->bookmark_bar_node();
1079 nodes.push_back(parent); 1081 nodes.push_back(parent);
1080 } 1082 }
1081 Profile* profile = browser_->profile(); 1083 Profile* profile = browser_->profile();
1082 bool close_on_remove = 1084 bool close_on_remove =
1083 (parent == profile->GetBookmarkModel()->other_node()) && 1085 (parent == profile->GetBookmarkModel()->other_node()) &&
1084 (parent->child_count() == 1); 1086 (parent->child_count() == 1);
1085 context_menu_.reset(new BookmarkContextMenu(GetWidget(), profile, 1087 context_menu_.reset(new BookmarkContextMenu(GetWidget(), profile,
1086 browser_->GetSelectedWebContents(), parent, nodes, close_on_remove)); 1088 browser_->GetSelectedWebContents(), parent, nodes, close_on_remove));
1087 context_menu_->RunMenuAt(p); 1089 context_menu_->RunMenuAt(point);
1088 } 1090 }
1089 1091
1090 void BookmarkBarView::Observe(int type, 1092 void BookmarkBarView::Observe(int type,
1091 const content::NotificationSource& source, 1093 const content::NotificationSource& source,
1092 const content::NotificationDetails& details) { 1094 const content::NotificationDetails& details) {
1093 DCHECK(browser_->profile()); 1095 DCHECK(browser_->profile());
1094 switch (type) { 1096 switch (type) {
1095 case chrome::NOTIFICATION_BOOKMARK_BUBBLE_SHOWN: { 1097 case chrome::NOTIFICATION_BOOKMARK_BUBBLE_SHOWN: {
1096 StopThrobbing(true); 1098 StopThrobbing(true);
1097 GURL url = *(content::Details<GURL>(details).ptr()); 1099 GURL url = *(content::Details<GURL>(details).ptr());
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 (1 - size_animation_->GetCurrentValue()))); 1665 (1 - size_animation_->GetCurrentValue())));
1664 } else { 1666 } else {
1665 prefsize.set_height( 1667 prefsize.set_height(
1666 static_cast<int>( 1668 static_cast<int>(
1667 browser_defaults::kBookmarkBarHeight * 1669 browser_defaults::kBookmarkBarHeight *
1668 size_animation_->GetCurrentValue())); 1670 size_animation_->GetCurrentValue()));
1669 } 1671 }
1670 } 1672 }
1671 return prefsize; 1673 return prefsize;
1672 } 1674 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698