OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_list/app_list_service_mac.h" | 5 #import "chrome/browser/ui/app_list/app_list_service_mac.h" |
6 | 6 |
7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
22 #include "chrome/browser/ui/app_list/app_list_positioner.h" | 22 #include "chrome/browser/ui/app_list/app_list_positioner.h" |
23 #include "chrome/browser/ui/app_list/app_list_service.h" | 23 #include "chrome/browser/ui/app_list/app_list_service.h" |
24 #include "chrome/browser/ui/app_list/app_list_service_cocoa_mac.h" | 24 #include "chrome/browser/ui/app_list/app_list_service_cocoa_mac.h" |
25 #include "chrome/browser/ui/app_list/app_list_service_impl.h" | 25 #include "chrome/browser/ui/app_list/app_list_service_impl.h" |
26 #include "chrome/browser/ui/app_list/app_list_util.h" | 26 #include "chrome/browser/ui/app_list/app_list_util.h" |
27 #include "chrome/browser/ui/browser_commands.h" | 27 #include "chrome/browser/ui/browser_commands.h" |
28 #include "chrome/browser/ui/extensions/application_launch.h" | 28 #include "chrome/browser/ui/extensions/application_launch.h" |
29 #include "chrome/browser/web_applications/web_app.h" | 29 #include "chrome/browser/web_applications/web_app.h" |
30 #include "chrome/browser/web_applications/web_app_mac.h" | 30 #include "chrome/browser/web_applications/web_app_mac.h" |
| 31 #include "chrome/common/channel_info.h" |
31 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/chrome_version_info.h" | |
33 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 33 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
34 #include "chrome/common/mac/app_mode_common.h" | 34 #include "chrome/common/mac/app_mode_common.h" |
35 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
36 #include "chrome/grit/google_chrome_strings.h" | 36 #include "chrome/grit/google_chrome_strings.h" |
| 37 #include "components/version_info/version_info.h" |
37 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
38 #include "extensions/browser/extension_system.h" | 39 #include "extensions/browser/extension_system.h" |
39 #include "extensions/common/manifest_handlers/file_handler_info.h" | 40 #include "extensions/common/manifest_handlers/file_handler_info.h" |
40 #include "grit/chrome_unscaled_resources.h" | 41 #include "grit/chrome_unscaled_resources.h" |
41 #include "net/base/url_util.h" | 42 #include "net/base/url_util.h" |
42 #include "ui/app_list/app_list_switches.h" | 43 #include "ui/app_list/app_list_switches.h" |
43 #include "ui/app_list/search_box_model.h" | 44 #include "ui/app_list/search_box_model.h" |
44 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
45 #include "ui/base/resource/resource_bundle.h" | 46 #include "ui/base/resource/resource_bundle.h" |
46 #include "ui/gfx/display.h" | 47 #include "ui/gfx/display.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 83 |
83 // Duration of show and hide animations. | 84 // Duration of show and hide animations. |
84 const NSTimeInterval kAnimationDuration = 0.2; | 85 const NSTimeInterval kAnimationDuration = 0.2; |
85 | 86 |
86 // Distance towards the screen edge that the app list moves from when showing. | 87 // Distance towards the screen edge that the app list moves from when showing. |
87 const CGFloat kDistanceMovedOnShow = 20; | 88 const CGFloat kDistanceMovedOnShow = 20; |
88 | 89 |
89 scoped_ptr<web_app::ShortcutInfo> GetAppListShortcutInfo( | 90 scoped_ptr<web_app::ShortcutInfo> GetAppListShortcutInfo( |
90 const base::FilePath& profile_path) { | 91 const base::FilePath& profile_path) { |
91 scoped_ptr<web_app::ShortcutInfo> shortcut_info(new web_app::ShortcutInfo); | 92 scoped_ptr<web_app::ShortcutInfo> shortcut_info(new web_app::ShortcutInfo); |
92 version_info::Channel channel = chrome::VersionInfo::GetChannel(); | 93 version_info::Channel channel = chrome::GetChannel(); |
93 if (channel == version_info::Channel::CANARY) { | 94 if (channel == version_info::Channel::CANARY) { |
94 shortcut_info->title = | 95 shortcut_info->title = |
95 l10n_util::GetStringUTF16(IDS_APP_LIST_SHORTCUT_NAME_CANARY); | 96 l10n_util::GetStringUTF16(IDS_APP_LIST_SHORTCUT_NAME_CANARY); |
96 } else { | 97 } else { |
97 shortcut_info->title = | 98 shortcut_info->title = |
98 l10n_util::GetStringUTF16(IDS_APP_LIST_SHORTCUT_NAME); | 99 l10n_util::GetStringUTF16(IDS_APP_LIST_SHORTCUT_NAME); |
99 } | 100 } |
100 | 101 |
101 shortcut_info->extension_id = app_mode::kAppListModeId; | 102 shortcut_info->extension_id = app_mode::kAppListModeId; |
102 shortcut_info->description = shortcut_info->title; | 103 shortcut_info->description = shortcut_info->title; |
103 shortcut_info->profile_path = profile_path; | 104 shortcut_info->profile_path = profile_path; |
104 | 105 |
105 return shortcut_info; | 106 return shortcut_info; |
106 } | 107 } |
107 | 108 |
108 void CreateAppListShim(const base::FilePath& profile_path) { | 109 void CreateAppListShim(const base::FilePath& profile_path) { |
109 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 110 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
110 WebApplicationInfo web_app_info; | 111 WebApplicationInfo web_app_info; |
111 scoped_ptr<web_app::ShortcutInfo> shortcut_info = | 112 scoped_ptr<web_app::ShortcutInfo> shortcut_info = |
112 GetAppListShortcutInfo(profile_path); | 113 GetAppListShortcutInfo(profile_path); |
113 | 114 |
114 ResourceBundle& resource_bundle = ResourceBundle::GetSharedInstance(); | 115 ResourceBundle& resource_bundle = ResourceBundle::GetSharedInstance(); |
115 version_info::Channel channel = chrome::VersionInfo::GetChannel(); | 116 version_info::Channel channel = chrome::GetChannel(); |
116 if (channel == version_info::Channel::CANARY) { | 117 if (channel == version_info::Channel::CANARY) { |
117 #if defined(GOOGLE_CHROME_BUILD) | 118 #if defined(GOOGLE_CHROME_BUILD) |
118 shortcut_info->favicon.Add( | 119 shortcut_info->favicon.Add( |
119 *resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_CANARY_16)); | 120 *resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_CANARY_16)); |
120 shortcut_info->favicon.Add( | 121 shortcut_info->favicon.Add( |
121 *resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_CANARY_32)); | 122 *resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_CANARY_32)); |
122 shortcut_info->favicon.Add( | 123 shortcut_info->favicon.Add( |
123 *resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_CANARY_128)); | 124 *resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_CANARY_128)); |
124 shortcut_info->favicon.Add( | 125 shortcut_info->favicon.Add( |
125 *resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_CANARY_256)); | 126 *resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_CANARY_256)); |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 | 584 |
584 - (void)animationDidEnd:(NSAnimation*)animation { | 585 - (void)animationDidEnd:(NSAnimation*)animation { |
585 content::BrowserThread::PostTask( | 586 content::BrowserThread::PostTask( |
586 content::BrowserThread::UI, | 587 content::BrowserThread::UI, |
587 FROM_HERE, | 588 FROM_HERE, |
588 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, | 589 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, |
589 base::Unretained(GetActiveInstance()))); | 590 base::Unretained(GetActiveInstance()))); |
590 } | 591 } |
591 | 592 |
592 @end | 593 @end |
OLD | NEW |