| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_bar_view.h" | 5 #include "chrome/browser/views/bookmark_bar_view.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/base_drag_source.h" | 10 #include "base/base_drag_source.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_context_menu.h" | 11 #include "chrome/browser/bookmarks/bookmark_context_menu.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_utils.h" | 12 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 13 #include "chrome/browser/browser.h" | 13 #include "chrome/browser/browser.h" |
| 14 #include "chrome/browser/browser_list.h" | 14 #include "chrome/browser/browser_list.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/browser_window.h" | 16 #include "chrome/browser/browser_window.h" |
| 17 #include "chrome/browser/drag_utils.h" | 17 #include "chrome/browser/drag_utils.h" |
| 18 #include "chrome/browser/download/download_util.h" | 18 #include "chrome/browser/download/download_util.h" |
| 19 #include "chrome/browser/history/history.h" | 19 #include "chrome/browser/history/history.h" |
| 20 #include "chrome/browser/metrics/user_metrics.h" | 20 #include "chrome/browser/metrics/user_metrics.h" |
| 21 #include "chrome/browser/profile.h" | 21 #include "chrome/browser/profile.h" |
| 22 #include "chrome/browser/tab_contents/page_navigator.h" | 22 #include "chrome/browser/tab_contents/page_navigator.h" |
| 23 #include "chrome/browser/tab_contents/tab_contents.h" | 23 #include "chrome/browser/tab_contents/tab_contents.h" |
| 24 #include "chrome/browser/view_ids.h" | 24 #include "chrome/browser/view_ids.h" |
| 25 #include "chrome/browser/views/bookmark_editor_view.h" | 25 #include "chrome/browser/views/bookmark_editor_view.h" |
| 26 #include "chrome/browser/views/event_utils.h" | 26 #include "chrome/browser/views/event_utils.h" |
| 27 #include "chrome/browser/views/frame/browser_view.h" |
| 27 #include "chrome/browser/views/input_window.h" | 28 #include "chrome/browser/views/input_window.h" |
| 28 #include "chrome/common/gfx/chrome_canvas.h" | 29 #include "chrome/common/gfx/chrome_canvas.h" |
| 29 #include "chrome/common/gfx/favicon_size.h" | 30 #include "chrome/common/gfx/favicon_size.h" |
| 30 #include "chrome/common/gfx/text_elider.h" | 31 #include "chrome/common/gfx/text_elider.h" |
| 31 #include "chrome/common/l10n_util.h" | 32 #include "chrome/common/l10n_util.h" |
| 32 #include "chrome/common/notification_service.h" | 33 #include "chrome/common/notification_service.h" |
| 33 #include "chrome/common/os_exchange_data.h" | 34 #include "chrome/common/os_exchange_data.h" |
| 34 #include "chrome/common/page_transition_types.h" | 35 #include "chrome/common/page_transition_types.h" |
| 35 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| 36 #include "chrome/common/pref_service.h" | 37 #include "chrome/common/pref_service.h" |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 height); | 862 height); |
| 862 x += other_bookmarked_pref.width() + kButtonPadding; | 863 x += other_bookmarked_pref.width() + kButtonPadding; |
| 863 } | 864 } |
| 864 | 865 |
| 865 void BookmarkBarView::DidChangeBounds(const gfx::Rect& previous, | 866 void BookmarkBarView::DidChangeBounds(const gfx::Rect& previous, |
| 866 const gfx::Rect& current) { | 867 const gfx::Rect& current) { |
| 867 Layout(); | 868 Layout(); |
| 868 } | 869 } |
| 869 | 870 |
| 870 void BookmarkBarView::ViewHierarchyChanged(bool is_add, | 871 void BookmarkBarView::ViewHierarchyChanged(bool is_add, |
| 871 View* parent, View* child) { | 872 View* parent, |
| 873 View* child) { |
| 874 // See http://code.google.com/p/chromium/issues/detail?id=7857 . It seems |
| 875 // as though the bookmark bar is getting unintentionally removed. |
| 876 DCHECK(child != this || !is_add || |
| 877 static_cast<BrowserView*>(parent)->is_removing_bookmark_bar()); |
| 878 |
| 872 if (is_add && child == this && height() > 0) { | 879 if (is_add && child == this && height() > 0) { |
| 873 // We only layout while parented. When we become parented, if our bounds | 880 // We only layout while parented. When we become parented, if our bounds |
| 874 // haven't changed, DidChangeBounds won't get invoked and we won't layout. | 881 // haven't changed, DidChangeBounds won't get invoked and we won't layout. |
| 875 // Therefore we always force a layout when added. | 882 // Therefore we always force a layout when added. |
| 876 Layout(); | 883 Layout(); |
| 877 } | 884 } |
| 878 } | 885 } |
| 879 | 886 |
| 880 void BookmarkBarView::Paint(ChromeCanvas* canvas) { | 887 void BookmarkBarView::Paint(ChromeCanvas* canvas) { |
| 881 if (IsDetachedStyle()) { | 888 if (IsDetachedStyle()) { |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 } | 1865 } |
| 1859 | 1866 |
| 1860 void BookmarkBarView::StopThrobbing(bool immediate) { | 1867 void BookmarkBarView::StopThrobbing(bool immediate) { |
| 1861 if (!throbbing_view_) | 1868 if (!throbbing_view_) |
| 1862 return; | 1869 return; |
| 1863 | 1870 |
| 1864 // If not immediate, cycle through 2 more complete cycles. | 1871 // If not immediate, cycle through 2 more complete cycles. |
| 1865 throbbing_view_->StartThrobbing(immediate ? 0 : 4); | 1872 throbbing_view_->StartThrobbing(immediate ? 0 : 4); |
| 1866 throbbing_view_ = NULL; | 1873 throbbing_view_ = NULL; |
| 1867 } | 1874 } |
| OLD | NEW |