| 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 <set> | 9 #include <set> |
| 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/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "chrome/browser/bookmarks/bookmark_model.h" | 18 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 19 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 19 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
| 22 #include "chrome/browser/defaults.h" | 22 #include "chrome/browser/defaults.h" |
| 23 #include "chrome/browser/extensions/extension_service.h" | |
| 24 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/search/search.h" | 24 #include "chrome/browser/search/search.h" |
| 26 #include "chrome/browser/sync/profile_sync_service.h" | 25 #include "chrome/browser/sync/profile_sync_service.h" |
| 27 #include "chrome/browser/sync/profile_sync_service_factory.h" | 26 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 28 #include "chrome/browser/themes/theme_properties.h" | 27 #include "chrome/browser/themes/theme_properties.h" |
| 29 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" | 28 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" |
| 30 #include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h" | 29 #include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h" |
| 31 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 30 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 32 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 31 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
| 33 #include "chrome/browser/ui/browser.h" | 32 #include "chrome/browser/ui/browser.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 50 #include "chrome/common/pref_names.h" | 49 #include "chrome/common/pref_names.h" |
| 51 #include "chrome/common/url_constants.h" | 50 #include "chrome/common/url_constants.h" |
| 52 #include "content/public/browser/notification_details.h" | 51 #include "content/public/browser/notification_details.h" |
| 53 #include "content/public/browser/notification_source.h" | 52 #include "content/public/browser/notification_source.h" |
| 54 #include "content/public/browser/page_navigator.h" | 53 #include "content/public/browser/page_navigator.h" |
| 55 #include "content/public/browser/render_view_host.h" | 54 #include "content/public/browser/render_view_host.h" |
| 56 #include "content/public/browser/render_widget_host_view.h" | 55 #include "content/public/browser/render_widget_host_view.h" |
| 57 #include "content/public/browser/user_metrics.h" | 56 #include "content/public/browser/user_metrics.h" |
| 58 #include "content/public/browser/web_contents.h" | 57 #include "content/public/browser/web_contents.h" |
| 59 #include "content/public/common/page_transition_types.h" | 58 #include "content/public/common/page_transition_types.h" |
| 59 #include "extensions/browser/extension_registry.h" |
| 60 #include "extensions/common/extension.h" |
| 61 #include "extensions/common/extension_set.h" |
| 60 #include "grit/generated_resources.h" | 62 #include "grit/generated_resources.h" |
| 61 #include "grit/theme_resources.h" | 63 #include "grit/theme_resources.h" |
| 62 #include "grit/ui_resources.h" | 64 #include "grit/ui_resources.h" |
| 63 #include "ui/accessibility/ax_view_state.h" | 65 #include "ui/accessibility/ax_view_state.h" |
| 64 #include "ui/base/dragdrop/drag_utils.h" | 66 #include "ui/base/dragdrop/drag_utils.h" |
| 65 #include "ui/base/dragdrop/os_exchange_data.h" | 67 #include "ui/base/dragdrop/os_exchange_data.h" |
| 66 #include "ui/base/l10n/l10n_util.h" | 68 #include "ui/base/l10n/l10n_util.h" |
| 67 #include "ui/base/resource/resource_bundle.h" | 69 #include "ui/base/resource/resource_bundle.h" |
| 68 #include "ui/base/theme_provider.h" | 70 #include "ui/base/theme_provider.h" |
| 69 #include "ui/base/window_open_disposition.h" | 71 #include "ui/base/window_open_disposition.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 return views::MenuButton::OnMousePressed(e); | 306 return views::MenuButton::OnMousePressed(e); |
| 305 } | 307 } |
| 306 | 308 |
| 307 private: | 309 private: |
| 308 BookmarkBarView* owner_; | 310 BookmarkBarView* owner_; |
| 309 | 311 |
| 310 DISALLOW_COPY_AND_ASSIGN(OverFlowButton); | 312 DISALLOW_COPY_AND_ASSIGN(OverFlowButton); |
| 311 }; | 313 }; |
| 312 | 314 |
| 313 void RecordAppLaunch(Profile* profile, GURL url) { | 315 void RecordAppLaunch(Profile* profile, GURL url) { |
| 314 DCHECK(profile->GetExtensionService()); | |
| 315 const extensions::Extension* extension = | 316 const extensions::Extension* extension = |
| 316 profile->GetExtensionService()->GetInstalledApp(url); | 317 extensions::ExtensionRegistry::Get(profile) |
| 318 ->enabled_extensions().GetAppByURL(url); |
| 317 if (!extension) | 319 if (!extension) |
| 318 return; | 320 return; |
| 319 | 321 |
| 320 CoreAppLauncherHandler::RecordAppLaunchType( | 322 CoreAppLauncherHandler::RecordAppLaunchType( |
| 321 extension_misc::APP_LAUNCH_BOOKMARK_BAR, | 323 extension_misc::APP_LAUNCH_BOOKMARK_BAR, |
| 322 extension->GetType()); | 324 extension->GetType()); |
| 323 } | 325 } |
| 324 | 326 |
| 325 } // namespace | 327 } // namespace |
| 326 | 328 |
| (...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1849 DCHECK(apps_page_shortcut_); | 1851 DCHECK(apps_page_shortcut_); |
| 1850 // Only perform layout if required. | 1852 // Only perform layout if required. |
| 1851 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( | 1853 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( |
| 1852 browser_->profile(), browser_->host_desktop_type()); | 1854 browser_->profile(), browser_->host_desktop_type()); |
| 1853 if (apps_page_shortcut_->visible() == visible) | 1855 if (apps_page_shortcut_->visible() == visible) |
| 1854 return; | 1856 return; |
| 1855 apps_page_shortcut_->SetVisible(visible); | 1857 apps_page_shortcut_->SetVisible(visible); |
| 1856 UpdateBookmarksSeparatorVisibility(); | 1858 UpdateBookmarksSeparatorVisibility(); |
| 1857 Layout(); | 1859 Layout(); |
| 1858 } | 1860 } |
| OLD | NEW |