| 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 <stdint.h> |
| 8 |
| 7 #include <algorithm> | 9 #include <algorithm> |
| 8 #include <limits> | 10 #include <limits> |
| 9 #include <string> | 11 #include <string> |
| 10 #include <vector> | 12 #include <vector> |
| 11 | 13 |
| 12 #include "base/bind.h" | 14 #include "base/bind.h" |
| 13 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
| 14 #include "base/location.h" | 16 #include "base/location.h" |
| 17 #include "base/macros.h" |
| 15 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 16 #include "base/prefs/pref_service.h" | 19 #include "base/prefs/pref_service.h" |
| 17 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
| 18 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/thread_task_runner_handle.h" | 23 #include "base/thread_task_runner_handle.h" |
| 24 #include "build/build_config.h" |
| 21 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 25 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 22 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" | 26 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" |
| 23 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/chrome_notification_types.h" | 28 #include "chrome/browser/chrome_notification_types.h" |
| 25 #include "chrome/browser/defaults.h" | 29 #include "chrome/browser/defaults.h" |
| 26 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/browser/search/search.h" | 31 #include "chrome/browser/search/search.h" |
| 28 #include "chrome/browser/sync/profile_sync_service_factory.h" | 32 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 29 #include "chrome/browser/themes/theme_properties.h" | 33 #include "chrome/browser/themes/theme_properties.h" |
| 30 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" | 34 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" |
| (...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 | 1215 |
| 1212 void BookmarkBarView::BookmarkMenuControllerDeleted( | 1216 void BookmarkBarView::BookmarkMenuControllerDeleted( |
| 1213 BookmarkMenuController* controller) { | 1217 BookmarkMenuController* controller) { |
| 1214 if (controller == bookmark_menu_) | 1218 if (controller == bookmark_menu_) |
| 1215 bookmark_menu_ = NULL; | 1219 bookmark_menu_ = NULL; |
| 1216 else if (controller == bookmark_drop_menu_) | 1220 else if (controller == bookmark_drop_menu_) |
| 1217 bookmark_drop_menu_ = NULL; | 1221 bookmark_drop_menu_ = NULL; |
| 1218 } | 1222 } |
| 1219 | 1223 |
| 1220 void BookmarkBarView::OnImportBookmarks() { | 1224 void BookmarkBarView::OnImportBookmarks() { |
| 1221 int64 install_time = g_browser_process->metrics_service()->GetInstallDate(); | 1225 int64_t install_time = g_browser_process->metrics_service()->GetInstallDate(); |
| 1222 int64 time_from_install = base::Time::Now().ToTimeT() - install_time; | 1226 int64_t time_from_install = base::Time::Now().ToTimeT() - install_time; |
| 1223 if (bookmark_bar_state_ == BookmarkBar::SHOW) { | 1227 if (bookmark_bar_state_ == BookmarkBar::SHOW) { |
| 1224 UMA_HISTOGRAM_COUNTS("Import.ShowDialog.FromBookmarkBarView", | 1228 UMA_HISTOGRAM_COUNTS("Import.ShowDialog.FromBookmarkBarView", |
| 1225 time_from_install); | 1229 time_from_install); |
| 1226 } else if (bookmark_bar_state_ == BookmarkBar::DETACHED) { | 1230 } else if (bookmark_bar_state_ == BookmarkBar::DETACHED) { |
| 1227 UMA_HISTOGRAM_COUNTS("Import.ShowDialog.FromFloatingBookmarkBarView", | 1231 UMA_HISTOGRAM_COUNTS("Import.ShowDialog.FromFloatingBookmarkBarView", |
| 1228 time_from_install); | 1232 time_from_install); |
| 1229 } | 1233 } |
| 1230 | 1234 |
| 1231 chrome::ShowImportDialog(browser_); | 1235 chrome::ShowImportDialog(browser_); |
| 1232 } | 1236 } |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2100 return; | 2104 return; |
| 2101 apps_page_shortcut_->SetVisible(visible); | 2105 apps_page_shortcut_->SetVisible(visible); |
| 2102 UpdateBookmarksSeparatorVisibility(); | 2106 UpdateBookmarksSeparatorVisibility(); |
| 2103 LayoutAndPaint(); | 2107 LayoutAndPaint(); |
| 2104 } | 2108 } |
| 2105 | 2109 |
| 2106 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { | 2110 void BookmarkBarView::OnShowManagedBookmarksPrefChanged() { |
| 2107 if (UpdateOtherAndManagedButtonsVisibility()) | 2111 if (UpdateOtherAndManagedButtonsVisibility()) |
| 2108 LayoutAndPaint(); | 2112 LayoutAndPaint(); |
| 2109 } | 2113 } |
| OLD | NEW |