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

Side by Side Diff: chrome/browser/views/bookmark_menu_controller_views.cc

Issue 115803: Fox some compilation problems for Linux. This also adds bookmark_bar_view to ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/bookmark_menu_controller_views.h" 5 #include "chrome/browser/views/bookmark_menu_controller_views.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/os_exchange_data.h" 8 #include "app/os_exchange_data.h"
9 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "chrome/browser/bookmarks/bookmark_drag_data.h" 10 #include "chrome/browser/bookmarks/bookmark_drag_data.h"
(...skipping 30 matching lines...) Expand all
41 if (show_other_folder) 41 if (show_other_folder)
42 BuildOtherFolderMenu(&next_menu_id); 42 BuildOtherFolderMenu(&next_menu_id);
43 } 43 }
44 44
45 void BookmarkMenuController::RunMenuAt( 45 void BookmarkMenuController::RunMenuAt(
46 const gfx::Rect& bounds, 46 const gfx::Rect& bounds,
47 views::MenuItemView::AnchorPosition position, 47 views::MenuItemView::AnchorPosition position,
48 bool for_drop) { 48 bool for_drop) {
49 for_drop_ = for_drop; 49 for_drop_ = for_drop;
50 profile_->GetBookmarkModel()->AddObserver(this); 50 profile_->GetBookmarkModel()->AddObserver(this);
51 #if defined(OS_WIN)
52 gfx::NativeView widget = parent_;
53 #else
54 gfx::NativeView widget = GTK_WIDGET(parent_);
55 #endif
51 if (for_drop) { 56 if (for_drop) {
52 menu_->RunMenuForDropAt(parent_, bounds, position); 57 menu_->RunMenuForDropAt(widget, bounds, position);
53 } else { 58 } else {
54 menu_->RunMenuAt(parent_, bounds, position, false); 59 menu_->RunMenuAt(widget, bounds, position, false);
55 delete this; 60 delete this;
56 } 61 }
57 } 62 }
58 63
59 void BookmarkMenuController::Cancel() { 64 void BookmarkMenuController::Cancel() {
60 menu_->Cancel(); 65 menu_->Cancel();
61 } 66 }
62 67
63 bool BookmarkMenuController::IsTriggerableEvent(const views::MouseEvent& e) { 68 bool BookmarkMenuController::IsTriggerableEvent(const views::MouseEvent& e) {
64 return event_utils::IsPossibleDispositionEvent(e); 69 return event_utils::IsPossibleDispositionEvent(e);
(...skipping 22 matching lines...) Expand all
87 BookmarkNode* drag_node = drop_data_.GetFirstNode(profile_); 92 BookmarkNode* drag_node = drop_data_.GetFirstNode(profile_);
88 if (!drag_node) { 93 if (!drag_node) {
89 // Dragging a group from another profile, always accept. 94 // Dragging a group from another profile, always accept.
90 return true; 95 return true;
91 } 96 }
92 97
93 // Drag originated from same profile and is not a URL. Only accept it if 98 // Drag originated from same profile and is not a URL. Only accept it if
94 // the dragged node is not a parent of the node menu represents. 99 // the dragged node is not a parent of the node menu represents.
95 BookmarkNode* drop_node = menu_id_to_node_map_[menu->GetCommand()]; 100 BookmarkNode* drop_node = menu_id_to_node_map_[menu->GetCommand()];
96 DCHECK(drop_node); 101 DCHECK(drop_node);
97 BookmarkNode* node = drop_node;
98 while (drop_node && drop_node != drag_node) 102 while (drop_node && drop_node != drag_node)
99 drop_node = drop_node->GetParent(); 103 drop_node = drop_node->GetParent();
100 return (drop_node == NULL); 104 return (drop_node == NULL);
101 } 105 }
102 106
103 int BookmarkMenuController::GetDropOperation( 107 int BookmarkMenuController::GetDropOperation(
104 views::MenuItemView* item, 108 views::MenuItemView* item,
105 const views::DropTargetEvent& event, 109 const views::DropTargetEvent& event,
106 DropPosition* position) { 110 DropPosition* position) {
107 // Should only get here if we have drop data. 111 // Should only get here if we have drop data.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 253 }
250 menu_id_to_node_map_[id] = node; 254 menu_id_to_node_map_[id] = node;
251 } 255 }
252 } 256 }
253 257
254 BookmarkMenuController::~BookmarkMenuController() { 258 BookmarkMenuController::~BookmarkMenuController() {
255 profile_->GetBookmarkModel()->RemoveObserver(this); 259 profile_->GetBookmarkModel()->RemoveObserver(this);
256 if (observer_) 260 if (observer_)
257 observer_->BookmarkMenuDeleted(this); 261 observer_->BookmarkMenuDeleted(this);
258 } 262 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698