Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: chrome/browser/shell_integration_win.cc

Issue 18106003: Respect policy when migrating existing icons with no AppId. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extra whitespace. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 5 #include "chrome/browser/shell_integration.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shobjidl.h> 8 #include <shobjidl.h>
9 #include <propkey.h> 9 #include <propkey.h>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/files/file_enumerator.h" 14 #include "base/files/file_enumerator.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/win/registry.h" 21 #include "base/win/registry.h"
22 #include "base/win/scoped_comptr.h" 22 #include "base/win/scoped_comptr.h"
23 #include "base/win/scoped_propvariant.h" 23 #include "base/win/scoped_propvariant.h"
24 #include "base/win/shortcut.h" 24 #include "base/win/shortcut.h"
25 #include "base/win/windows_version.h" 25 #include "base/win/windows_version.h"
26 #include "chrome/browser/policy/policy_path_parser.h"
26 #include "chrome/browser/web_applications/web_app.h" 27 #include "chrome/browser/web_applications/web_app.h"
27 #include "chrome/common/chrome_constants.h" 28 #include "chrome/common/chrome_constants.h"
28 #include "chrome/common/chrome_paths_internal.h" 29 #include "chrome/common/chrome_paths_internal.h"
29 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
30 #include "chrome/installer/setup/setup_util.h" 31 #include "chrome/installer/setup/setup_util.h"
31 #include "chrome/installer/util/browser_distribution.h" 32 #include "chrome/installer/util/browser_distribution.h"
32 #include "chrome/installer/util/create_reg_key_work_item.h" 33 #include "chrome/installer/util/create_reg_key_work_item.h"
33 #include "chrome/installer/util/install_util.h" 34 #include "chrome/installer/util/install_util.h"
34 #include "chrome/installer/util/set_reg_value_work_item.h" 35 #include "chrome/installer/util/set_reg_value_work_item.h"
35 #include "chrome/installer/util/shell_util.h" 36 #include "chrome/installer/util/shell_util.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 90
90 // Gets expected app id for given Chrome (based on |command_line| and 91 // Gets expected app id for given Chrome (based on |command_line| and
91 // |is_per_user_install|). 92 // |is_per_user_install|).
92 string16 GetExpectedAppId(const CommandLine& command_line, 93 string16 GetExpectedAppId(const CommandLine& command_line,
93 bool is_per_user_install) { 94 bool is_per_user_install) {
94 base::FilePath user_data_dir; 95 base::FilePath user_data_dir;
95 if (command_line.HasSwitch(switches::kUserDataDir)) 96 if (command_line.HasSwitch(switches::kUserDataDir))
96 user_data_dir = command_line.GetSwitchValuePath(switches::kUserDataDir); 97 user_data_dir = command_line.GetSwitchValuePath(switches::kUserDataDir);
97 else 98 else
98 chrome::GetDefaultUserDataDirectory(&user_data_dir); 99 chrome::GetDefaultUserDataDirectory(&user_data_dir);
100 // Adjust with any policy that overrides any other way to set the path.
101 policy::path_parser::CheckUserDataDirPolicy(&user_data_dir);
99 DCHECK(!user_data_dir.empty()); 102 DCHECK(!user_data_dir.empty());
100 103
101 base::FilePath profile_subdir; 104 base::FilePath profile_subdir;
102 if (command_line.HasSwitch(switches::kProfileDirectory)) { 105 if (command_line.HasSwitch(switches::kProfileDirectory)) {
103 profile_subdir = 106 profile_subdir =
104 command_line.GetSwitchValuePath(switches::kProfileDirectory); 107 command_line.GetSwitchValuePath(switches::kProfileDirectory);
105 } else { 108 } else {
106 profile_subdir = base::FilePath(ASCIIToUTF16(chrome::kInitialProfile)); 109 profile_subdir = base::FilePath(ASCIIToUTF16(chrome::kInitialProfile));
107 } 110 }
108 DCHECK(!profile_subdir.empty()); 111 DCHECK(!profile_subdir.empty());
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 } 529 }
527 530
528 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + 531 shortcut = shortcut.Append(shortcut_name).Append(shortcut_name +
529 installer::kLnkExt); 532 installer::kLnkExt);
530 if (file_util::PathExists(shortcut)) 533 if (file_util::PathExists(shortcut))
531 return shortcut; 534 return shortcut;
532 } 535 }
533 536
534 return base::FilePath(); 537 return base::FilePath();
535 } 538 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698