OLD | NEW |
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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 14 #include "base/location.h" |
14 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
15 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
| 17 #include "base/single_thread_task_runner.h" |
16 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
17 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/thread_task_runner_handle.h" |
18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 21 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
19 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" | 22 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
20 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" | 23 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h" |
21 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
22 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
23 #include "chrome/browser/defaults.h" | 26 #include "chrome/browser/defaults.h" |
24 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/search/search.h" | 28 #include "chrome/browser/search/search.h" |
26 #include "chrome/browser/sync/profile_sync_service.h" | 29 #include "chrome/browser/sync/profile_sync_service.h" |
27 #include "chrome/browser/sync/profile_sync_service_factory.h" | 30 #include "chrome/browser/sync/profile_sync_service_factory.h" |
(...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 } | 1825 } |
1823 | 1826 |
1824 void BookmarkBarView::StartShowFolderDropMenuTimer(const BookmarkNode* node) { | 1827 void BookmarkBarView::StartShowFolderDropMenuTimer(const BookmarkNode* node) { |
1825 if (!animations_enabled) { | 1828 if (!animations_enabled) { |
1826 // So that tests can run as fast as possible disable the delay during | 1829 // So that tests can run as fast as possible disable the delay during |
1827 // testing. | 1830 // testing. |
1828 ShowDropFolderForNode(node); | 1831 ShowDropFolderForNode(node); |
1829 return; | 1832 return; |
1830 } | 1833 } |
1831 show_folder_method_factory_.InvalidateWeakPtrs(); | 1834 show_folder_method_factory_.InvalidateWeakPtrs(); |
1832 base::MessageLoop::current()->PostDelayedTask( | 1835 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
1833 FROM_HERE, | 1836 FROM_HERE, base::Bind(&BookmarkBarView::ShowDropFolderForNode, |
1834 base::Bind(&BookmarkBarView::ShowDropFolderForNode, | 1837 show_folder_method_factory_.GetWeakPtr(), node), |
1835 show_folder_method_factory_.GetWeakPtr(), | |
1836 node), | |
1837 base::TimeDelta::FromMilliseconds(views::GetMenuShowDelay())); | 1838 base::TimeDelta::FromMilliseconds(views::GetMenuShowDelay())); |
1838 } | 1839 } |
1839 | 1840 |
1840 void BookmarkBarView::CalculateDropLocation(const DropTargetEvent& event, | 1841 void BookmarkBarView::CalculateDropLocation(const DropTargetEvent& event, |
1841 const BookmarkNodeData& data, | 1842 const BookmarkNodeData& data, |
1842 DropLocation* location) { | 1843 DropLocation* location) { |
1843 DCHECK(model_); | 1844 DCHECK(model_); |
1844 DCHECK(model_->loaded()); | 1845 DCHECK(model_->loaded()); |
1845 DCHECK(data.is_valid()); | 1846 DCHECK(data.is_valid()); |
1846 | 1847 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2072 return; | 2073 return; |
2073 apps_page_shortcut_->SetVisible(visible); | 2074 apps_page_shortcut_->SetVisible(visible); |
2074 UpdateBookmarksSeparatorVisibility(); | 2075 UpdateBookmarksSeparatorVisibility(); |
2075 LayoutAndPaint(); | 2076 LayoutAndPaint(); |
2076 } | 2077 } |
2077 | 2078 |
2078 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2079 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
2079 if (UpdateOtherAndManagedButtonsVisibility()) | 2080 if (UpdateOtherAndManagedButtonsVisibility()) |
2080 LayoutAndPaint(); | 2081 LayoutAndPaint(); |
2081 } | 2082 } |
OLD | NEW |