| 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 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
| 8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_model.h" | 12 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 13 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 14 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_stats.h" | 15 #include "chrome/browser/bookmarks/bookmark_stats.h" |
| 16 #include "chrome/browser/extensions/extension_service.h" | |
| 17 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 16 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/themes/theme_properties.h" | 18 #include "chrome/browser/themes/theme_properties.h" |
| 20 #include "chrome/browser/themes/theme_service.h" | 19 #include "chrome/browser/themes/theme_service.h" |
| 21 #import "chrome/browser/themes/theme_service_factory.h" | 20 #import "chrome/browser/themes/theme_service_factory.h" |
| 22 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" | 21 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" |
| 23 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 22 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
| 24 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 25 #include "chrome/browser/ui/browser_list.h" | 24 #include "chrome/browser/ui/browser_list.h" |
| 26 #include "chrome/browser/ui/chrome_pages.h" | 25 #include "chrome/browser/ui/chrome_pages.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 45 #import "chrome/browser/ui/cocoa/view_id_util.h" | 44 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 46 #import "chrome/browser/ui/cocoa/view_resizer.h" | 45 #import "chrome/browser/ui/cocoa/view_resizer.h" |
| 47 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 46 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 48 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h" | 47 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h" |
| 49 #include "chrome/common/extensions/extension_constants.h" | 48 #include "chrome/common/extensions/extension_constants.h" |
| 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/user_metrics.h" | 51 #include "content/public/browser/user_metrics.h" |
| 53 #include "content/public/browser/web_contents.h" | 52 #include "content/public/browser/web_contents.h" |
| 54 #include "content/public/browser/web_contents_view.h" | 53 #include "content/public/browser/web_contents_view.h" |
| 54 #include "extensions/browser/extension_registry.h" |
| 55 #include "extensions/common/extension.h" |
| 56 #include "extensions/common/extension_set.h" |
| 55 #include "grit/generated_resources.h" | 57 #include "grit/generated_resources.h" |
| 56 #include "grit/theme_resources.h" | 58 #include "grit/theme_resources.h" |
| 57 #include "grit/ui_resources.h" | 59 #include "grit/ui_resources.h" |
| 58 #import "ui/base/cocoa/cocoa_base_utils.h" | 60 #import "ui/base/cocoa/cocoa_base_utils.h" |
| 59 #include "ui/base/l10n/l10n_util_mac.h" | 61 #include "ui/base/l10n/l10n_util_mac.h" |
| 60 #include "ui/base/resource/resource_bundle.h" | 62 #include "ui/base/resource/resource_bundle.h" |
| 61 #include "ui/gfx/image/image.h" | 63 #include "ui/gfx/image/image.h" |
| 62 | 64 |
| 63 using base::UserMetricsAction; | 65 using base::UserMetricsAction; |
| 64 using content::OpenURLParams; | 66 using content::OpenURLParams; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // |-bookmarkBar:willAnimateFromState:toState:| in order to inform the | 127 // |-bookmarkBar:willAnimateFromState:toState:| in order to inform the |
| 126 // toolbar of required changes. | 128 // toolbar of required changes. |
| 127 | 129 |
| 128 namespace { | 130 namespace { |
| 129 | 131 |
| 130 // Duration of the bookmark bar animations. | 132 // Duration of the bookmark bar animations. |
| 131 const NSTimeInterval kBookmarkBarAnimationDuration = 0.12; | 133 const NSTimeInterval kBookmarkBarAnimationDuration = 0.12; |
| 132 const NSTimeInterval kDragAndDropAnimationDuration = 0.25; | 134 const NSTimeInterval kDragAndDropAnimationDuration = 0.25; |
| 133 | 135 |
| 134 void RecordAppLaunch(Profile* profile, GURL url) { | 136 void RecordAppLaunch(Profile* profile, GURL url) { |
| 135 DCHECK(profile->GetExtensionService()); | |
| 136 const extensions::Extension* extension = | 137 const extensions::Extension* extension = |
| 137 profile->GetExtensionService()->GetInstalledApp(url); | 138 ExtensionRegistry::Get(profile)->enabled_extensions().GetAppByURL(url); |
| 138 if (!extension) | 139 if (!extension) |
| 139 return; | 140 return; |
| 140 | 141 |
| 141 CoreAppLauncherHandler::RecordAppLaunchType( | 142 CoreAppLauncherHandler::RecordAppLaunchType( |
| 142 extension_misc::APP_LAUNCH_BOOKMARK_BAR, | 143 extension_misc::APP_LAUNCH_BOOKMARK_BAR, |
| 143 extension->GetType()); | 144 extension->GetType()); |
| 144 } | 145 } |
| 145 | 146 |
| 146 } // namespace | 147 } // namespace |
| 147 | 148 |
| (...skipping 2530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2678 - (id<BookmarkButtonControllerProtocol>)controllerForNode: | 2679 - (id<BookmarkButtonControllerProtocol>)controllerForNode: |
| 2679 (const BookmarkNode*)node { | 2680 (const BookmarkNode*)node { |
| 2680 // See if it's in the bar, then if it is in the hierarchy of visible | 2681 // See if it's in the bar, then if it is in the hierarchy of visible |
| 2681 // folder menus. | 2682 // folder menus. |
| 2682 if (bookmarkModel_->bookmark_bar_node() == node) | 2683 if (bookmarkModel_->bookmark_bar_node() == node) |
| 2683 return self; | 2684 return self; |
| 2684 return [folderController_ controllerForNode:node]; | 2685 return [folderController_ controllerForNode:node]; |
| 2685 } | 2686 } |
| 2686 | 2687 |
| 2687 @end | 2688 @end |
| OLD | NEW |