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/shell_integration_win.h" | 5 #include "chrome/browser/shell_integration_win.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 base::CreateTemporaryFileInDir(temp_dir_.path(), &chrome_exe_); | 51 base::CreateTemporaryFileInDir(temp_dir_.path(), &chrome_exe_); |
52 | 52 |
53 chrome_app_id_ = | 53 chrome_app_id_ = |
54 ShellUtil::GetBrowserModelId(BrowserDistribution::GetDistribution(), | 54 ShellUtil::GetBrowserModelId(BrowserDistribution::GetDistribution(), |
55 true); | 55 true); |
56 | 56 |
57 base::FilePath default_user_data_dir; | 57 base::FilePath default_user_data_dir; |
58 chrome::GetDefaultUserDataDirectory(&default_user_data_dir); | 58 chrome::GetDefaultUserDataDirectory(&default_user_data_dir); |
59 base::FilePath default_profile_path = | 59 base::FilePath default_profile_path = |
60 default_user_data_dir.AppendASCII(chrome::kInitialProfile); | 60 default_user_data_dir.AppendASCII(chrome::kInitialProfile); |
61 app_list_app_id_ = GetAppListAppModelIdForProfile(default_profile_path); | |
62 non_default_user_data_dir_ = base::FilePath(FILE_PATH_LITERAL("root")) | 61 non_default_user_data_dir_ = base::FilePath(FILE_PATH_LITERAL("root")) |
63 .Append(FILE_PATH_LITERAL("Non Default Data Dir")); | 62 .Append(FILE_PATH_LITERAL("Non Default Data Dir")); |
64 non_default_profile_ = L"NonDefault"; | 63 non_default_profile_ = L"NonDefault"; |
65 non_default_profile_chrome_app_id_ = GetChromiumModelIdForProfile( | 64 non_default_profile_chrome_app_id_ = GetChromiumModelIdForProfile( |
66 default_user_data_dir.Append(non_default_profile_)); | 65 default_user_data_dir.Append(non_default_profile_)); |
67 non_default_user_data_dir_chrome_app_id_ = GetChromiumModelIdForProfile( | 66 non_default_user_data_dir_chrome_app_id_ = GetChromiumModelIdForProfile( |
68 non_default_user_data_dir_.AppendASCII(chrome::kInitialProfile)); | 67 non_default_user_data_dir_.AppendASCII(chrome::kInitialProfile)); |
69 non_default_user_data_dir_and_profile_chrome_app_id_ = | 68 non_default_user_data_dir_and_profile_chrome_app_id_ = |
70 GetChromiumModelIdForProfile( | 69 GetChromiumModelIdForProfile( |
71 non_default_user_data_dir_.Append(non_default_profile_)); | 70 non_default_user_data_dir_.Append(non_default_profile_)); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // Chrome's AppUserModelId for the non-default profile. | 237 // Chrome's AppUserModelId for the non-default profile. |
239 base::string16 non_default_profile_chrome_app_id_; | 238 base::string16 non_default_profile_chrome_app_id_; |
240 | 239 |
241 // Chrome's AppUserModelId for the non-default user data dir. | 240 // Chrome's AppUserModelId for the non-default user data dir. |
242 base::string16 non_default_user_data_dir_chrome_app_id_; | 241 base::string16 non_default_user_data_dir_chrome_app_id_; |
243 | 242 |
244 // Chrome's AppUserModelId for the non-default user data dir and non-default | 243 // Chrome's AppUserModelId for the non-default user data dir and non-default |
245 // profile. | 244 // profile. |
246 base::string16 non_default_user_data_dir_and_profile_chrome_app_id_; | 245 base::string16 non_default_user_data_dir_and_profile_chrome_app_id_; |
247 | 246 |
248 // The app launcher's app id. | |
249 base::string16 app_list_app_id_; | |
250 | |
251 // An example extension id of an example app. | 247 // An example extension id of an example app. |
252 base::string16 extension_id_; | 248 base::string16 extension_id_; |
253 | 249 |
254 // The app id of the example app for the default profile and user data dir. | 250 // The app id of the example app for the default profile and user data dir. |
255 base::string16 extension_app_id_; | 251 base::string16 extension_app_id_; |
256 | 252 |
257 // The app id of the example app for the non-default profile. | 253 // The app id of the example app for the non-default profile. |
258 base::string16 non_default_profile_extension_app_id_; | 254 base::string16 non_default_profile_extension_app_id_; |
259 | 255 |
260 private: | 256 private: |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 310 |
315 // Non-default profile path should get chrome::kBrowserAppID joined with | 311 // Non-default profile path should get chrome::kBrowserAppID joined with |
316 // profile info. | 312 // profile info. |
317 base::FilePath profile_path(FILE_PATH_LITERAL("root")); | 313 base::FilePath profile_path(FILE_PATH_LITERAL("root")); |
318 profile_path = profile_path.Append(FILE_PATH_LITERAL("udd")); | 314 profile_path = profile_path.Append(FILE_PATH_LITERAL("udd")); |
319 profile_path = profile_path.Append(FILE_PATH_LITERAL("User Data - Test")); | 315 profile_path = profile_path.Append(FILE_PATH_LITERAL("User Data - Test")); |
320 EXPECT_EQ(base_app_id + L".udd.UserDataTest", | 316 EXPECT_EQ(base_app_id + L".udd.UserDataTest", |
321 GetAppModelIdForProfile(base_app_id, profile_path)); | 317 GetAppModelIdForProfile(base_app_id, profile_path)); |
322 } | 318 } |
323 | 319 |
324 TEST(ShellIntegrationWinTest, GetAppListAppModelIdForProfileTest) { | |
325 base::string16 base_app_id( | |
326 BrowserDistribution::GetDistribution()->GetBaseAppId()); | |
327 base_app_id.append(L"AppList"); | |
328 | |
329 // Empty profile path should get chrome::kBrowserAppID + AppList | |
330 base::FilePath empty_path; | |
331 EXPECT_EQ(base_app_id, GetAppListAppModelIdForProfile(empty_path)); | |
332 | |
333 // Default profile path should get chrome::kBrowserAppID + AppList | |
334 base::FilePath default_user_data_dir; | |
335 chrome::GetDefaultUserDataDirectory(&default_user_data_dir); | |
336 base::FilePath default_profile_path = | |
337 default_user_data_dir.AppendASCII(chrome::kInitialProfile); | |
338 EXPECT_EQ(base_app_id, GetAppListAppModelIdForProfile(default_profile_path)); | |
339 | |
340 // Non-default profile path should get chrome::kBrowserAppID + AppList joined | |
341 // with profile info. | |
342 base::FilePath profile_path(FILE_PATH_LITERAL("root")); | |
343 profile_path = profile_path.Append(FILE_PATH_LITERAL("udd")); | |
344 profile_path = profile_path.Append(FILE_PATH_LITERAL("User Data - Test")); | |
345 EXPECT_EQ(base_app_id + L".udd.UserDataTest", | |
346 GetAppListAppModelIdForProfile(profile_path)); | |
347 } | |
348 | |
349 } // namespace win | 320 } // namespace win |
350 } // namespace shell_integration | 321 } // namespace shell_integration |
OLD | NEW |