OLD | NEW |
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 #ifndef CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 virtual void Observe(NotificationType type, | 246 virtual void Observe(NotificationType type, |
247 const NotificationSource& source, | 247 const NotificationSource& source, |
248 const NotificationDetails& details) OVERRIDE; | 248 const NotificationDetails& details) OVERRIDE; |
249 | 249 |
250 // If true we're running tests. This short circuits a couple of animations. | 250 // If true we're running tests. This short circuits a couple of animations. |
251 static bool testing_; | 251 static bool testing_; |
252 | 252 |
253 private: | 253 private: |
254 class ButtonSeparatorView; | 254 class ButtonSeparatorView; |
255 struct DropInfo; | 255 struct DropInfo; |
| 256 struct DropLocation; |
256 | 257 |
257 friend class BookmarkBarViewEventTestBase; | 258 friend class BookmarkBarViewEventTestBase; |
258 FRIEND_TEST_ALL_PREFIXES(BookmarkBarViewTest, SwitchProfile); | 259 FRIEND_TEST_ALL_PREFIXES(BookmarkBarViewTest, SwitchProfile); |
259 | 260 |
| 261 // Used to identify what the user is dropping onto. |
| 262 enum DropButtonType { |
| 263 DROP_BOOKMARK, |
| 264 DROP_OTHER_FOLDER, |
| 265 DROP_OVERFLOW |
| 266 }; |
| 267 |
260 // Creates recent bookmark button and when visible button as well as | 268 // Creates recent bookmark button and when visible button as well as |
261 // calculating the preferred height. | 269 // calculating the preferred height. |
262 void Init(); | 270 void Init(); |
263 | 271 |
264 // NOTE: unless otherwise stated all methods that take an int for an index are | 272 // NOTE: unless otherwise stated all methods that take an int for an index are |
265 // in terms of the bookmark bar view. Typically the view index and model index | 273 // in terms of the bookmark bar view. Typically the view index and model index |
266 // are the same, but they may differ during animations or drag and drop. | 274 // are the same, but they may differ during animations or drag and drop. |
267 // | 275 // |
268 // It's easy to get the mapping wrong. For this reason all these methods are | 276 // It's easy to get the mapping wrong. For this reason all these methods are |
269 // private. | 277 // private. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 320 |
313 // Shows the menu used during drag and drop for the specified node. | 321 // Shows the menu used during drag and drop for the specified node. |
314 void ShowDropFolderForNode(const BookmarkNode* node); | 322 void ShowDropFolderForNode(const BookmarkNode* node); |
315 | 323 |
316 // Cancels the timer used to show a drop menu. | 324 // Cancels the timer used to show a drop menu. |
317 void StopShowFolderDropMenuTimer(); | 325 void StopShowFolderDropMenuTimer(); |
318 | 326 |
319 // Stars the timer used to show a drop menu for node. | 327 // Stars the timer used to show a drop menu for node. |
320 void StartShowFolderDropMenuTimer(const BookmarkNode* node); | 328 void StartShowFolderDropMenuTimer(const BookmarkNode* node); |
321 | 329 |
322 // Returns the drop operation and index for the drop based on the event | 330 // Calculates the location for the drop in |location|. |
323 // and data. Returns ui::DragDropTypes::DRAG_NONE if not a valid location. | 331 void CalculateDropLocation(const views::DropTargetEvent& event, |
324 int CalculateDropOperation(const views::DropTargetEvent& event, | |
325 const BookmarkNodeData& data, | 332 const BookmarkNodeData& data, |
326 int* index, | 333 DropLocation* location); |
327 bool* drop_on, | |
328 bool* is_over_overflow, | |
329 bool* is_over_other); | |
330 | 334 |
331 // Writes a BookmarkNodeData for node to data. | 335 // Writes a BookmarkNodeData for node to data. |
332 void WriteBookmarkDragData(const BookmarkNode* node, | 336 void WriteBookmarkDragData(const BookmarkNode* node, |
333 ui::OSExchangeData* data); | 337 ui::OSExchangeData* data); |
334 | 338 |
335 // This determines which view should throb and starts it | 339 // This determines which view should throb and starts it |
336 // throbbing (e.g when the bookmark bubble is showing). | 340 // throbbing (e.g when the bookmark bubble is showing). |
337 // If |overflow_only| is true, start throbbing only if |node| is hidden in | 341 // If |overflow_only| is true, start throbbing only if |node| is hidden in |
338 // the overflow menu. | 342 // the overflow menu. |
339 void StartThrobbing(const BookmarkNode* node, bool overflow_only); | 343 void StartThrobbing(const BookmarkNode* node, bool overflow_only); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 418 |
415 // If the bookmark bubble is showing, this is the visible ancestor of the URL. | 419 // If the bookmark bubble is showing, this is the visible ancestor of the URL. |
416 // The visible ancestor is either the other_bookmarked_button_, | 420 // The visible ancestor is either the other_bookmarked_button_, |
417 // overflow_button_ or a button on the bar. | 421 // overflow_button_ or a button on the bar. |
418 views::CustomButton* throbbing_view_; | 422 views::CustomButton* throbbing_view_; |
419 | 423 |
420 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); | 424 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); |
421 }; | 425 }; |
422 | 426 |
423 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 427 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
OLD | NEW |