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 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 // Version of the app list shortcut version installed. | 85 // Version of the app list shortcut version installed. |
86 const int kShortcutVersion = 4; | 86 const int kShortcutVersion = 4; |
87 | 87 |
88 // Duration of show and hide animations. | 88 // Duration of show and hide animations. |
89 const NSTimeInterval kAnimationDuration = 0.2; | 89 const NSTimeInterval kAnimationDuration = 0.2; |
90 | 90 |
91 // Distance towards the screen edge that the app list moves from when showing. | 91 // Distance towards the screen edge that the app list moves from when showing. |
92 const CGFloat kDistanceMovedOnShow = 20; | 92 const CGFloat kDistanceMovedOnShow = 20; |
93 | 93 |
94 scoped_ptr<web_app::ShortcutInfo> GetAppListShortcutInfo( | 94 std::unique_ptr<web_app::ShortcutInfo> GetAppListShortcutInfo( |
95 const base::FilePath& profile_path) { | 95 const base::FilePath& profile_path) { |
96 scoped_ptr<web_app::ShortcutInfo> shortcut_info(new web_app::ShortcutInfo); | 96 std::unique_ptr<web_app::ShortcutInfo> shortcut_info( |
| 97 new web_app::ShortcutInfo); |
97 version_info::Channel channel = chrome::GetChannel(); | 98 version_info::Channel channel = chrome::GetChannel(); |
98 if (channel == version_info::Channel::CANARY) { | 99 if (channel == version_info::Channel::CANARY) { |
99 shortcut_info->title = | 100 shortcut_info->title = |
100 l10n_util::GetStringUTF16(IDS_APP_LIST_SHORTCUT_NAME_CANARY); | 101 l10n_util::GetStringUTF16(IDS_APP_LIST_SHORTCUT_NAME_CANARY); |
101 } else { | 102 } else { |
102 shortcut_info->title = | 103 shortcut_info->title = |
103 l10n_util::GetStringUTF16(IDS_APP_LIST_SHORTCUT_NAME); | 104 l10n_util::GetStringUTF16(IDS_APP_LIST_SHORTCUT_NAME); |
104 } | 105 } |
105 | 106 |
106 shortcut_info->extension_id = app_mode::kAppListModeId; | 107 shortcut_info->extension_id = app_mode::kAppListModeId; |
107 shortcut_info->description = shortcut_info->title; | 108 shortcut_info->description = shortcut_info->title; |
108 shortcut_info->profile_path = profile_path; | 109 shortcut_info->profile_path = profile_path; |
109 | 110 |
110 return shortcut_info; | 111 return shortcut_info; |
111 } | 112 } |
112 | 113 |
113 void CreateAppListShim(const base::FilePath& profile_path) { | 114 void CreateAppListShim(const base::FilePath& profile_path) { |
114 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 115 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
115 WebApplicationInfo web_app_info; | 116 WebApplicationInfo web_app_info; |
116 scoped_ptr<web_app::ShortcutInfo> shortcut_info = | 117 std::unique_ptr<web_app::ShortcutInfo> shortcut_info = |
117 GetAppListShortcutInfo(profile_path); | 118 GetAppListShortcutInfo(profile_path); |
118 | 119 |
119 ResourceBundle& resource_bundle = ResourceBundle::GetSharedInstance(); | 120 ResourceBundle& resource_bundle = ResourceBundle::GetSharedInstance(); |
120 version_info::Channel channel = chrome::GetChannel(); | 121 version_info::Channel channel = chrome::GetChannel(); |
121 if (channel == version_info::Channel::CANARY) { | 122 if (channel == version_info::Channel::CANARY) { |
122 #if defined(GOOGLE_CHROME_BUILD) | 123 #if defined(GOOGLE_CHROME_BUILD) |
123 shortcut_info->favicon.Add( | 124 shortcut_info->favicon.Add( |
124 *resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_CANARY_16)); | 125 *resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_CANARY_16)); |
125 shortcut_info->favicon.Add( | 126 shortcut_info->favicon.Add( |
126 *resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_CANARY_32)); | 127 *resource_bundle.GetImageSkiaNamed(IDR_APP_LIST_CANARY_32)); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 | 581 |
581 - (void)animationDidEnd:(NSAnimation*)animation { | 582 - (void)animationDidEnd:(NSAnimation*)animation { |
582 content::BrowserThread::PostTask( | 583 content::BrowserThread::PostTask( |
583 content::BrowserThread::UI, | 584 content::BrowserThread::UI, |
584 FROM_HERE, | 585 FROM_HERE, |
585 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, | 586 base::Bind(&AppListServiceMac::WindowAnimationDidEnd, |
586 base::Unretained(GetActiveInstance()))); | 587 base::Unretained(GetActiveInstance()))); |
587 } | 588 } |
588 | 589 |
589 @end | 590 @end |
OLD | NEW |