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

Side by Side Diff: chrome/installer/util/shell_util.cc

Issue 1581473002: Remove base/win/metro.{cc|h} and some associated code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 4 years, 11 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
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 // This file defines functions that integrate Chrome in Windows shell. These 5 // This file defines functions that integrate Chrome in Windows shell. These
6 // functions can be used by Chrome as well as Chrome installer. All of the 6 // functions can be used by Chrome as well as Chrome installer. All of the
7 // work is done by the local functions defined in anonymous namespace in 7 // work is done by the local functions defined in anonymous namespace in
8 // this class. 8 // this class.
9 9
10 #include "chrome/installer/util/shell_util.h" 10 #include "chrome/installer/util/shell_util.h"
(...skipping 18 matching lines...) Expand all
29 #include "base/memory/scoped_vector.h" 29 #include "base/memory/scoped_vector.h"
30 #include "base/path_service.h" 30 #include "base/path_service.h"
31 #include "base/strings/string16.h" 31 #include "base/strings/string16.h"
32 #include "base/strings/string_number_conversions.h" 32 #include "base/strings/string_number_conversions.h"
33 #include "base/strings/string_split.h" 33 #include "base/strings/string_split.h"
34 #include "base/strings/string_util.h" 34 #include "base/strings/string_util.h"
35 #include "base/strings/stringprintf.h" 35 #include "base/strings/stringprintf.h"
36 #include "base/strings/utf_string_conversions.h" 36 #include "base/strings/utf_string_conversions.h"
37 #include "base/synchronization/cancellation_flag.h" 37 #include "base/synchronization/cancellation_flag.h"
38 #include "base/values.h" 38 #include "base/values.h"
39 #include "base/win/metro.h"
40 #include "base/win/registry.h" 39 #include "base/win/registry.h"
41 #include "base/win/scoped_co_mem.h" 40 #include "base/win/scoped_co_mem.h"
42 #include "base/win/scoped_comptr.h" 41 #include "base/win/scoped_comptr.h"
43 #include "base/win/shortcut.h" 42 #include "base/win/shortcut.h"
44 #include "base/win/win_util.h" 43 #include "base/win/win_util.h"
45 #include "base/win/windows_version.h" 44 #include "base/win/windows_version.h"
46 #include "chrome/common/chrome_constants.h" 45 #include "chrome/common/chrome_constants.h"
47 #include "chrome/common/chrome_switches.h" 46 #include "chrome/common/chrome_switches.h"
48 #include "chrome/installer/util/beacons.h" 47 #include "chrome/installer/util/beacons.h"
49 #include "chrome/installer/util/browser_distribution.h" 48 #include "chrome/installer/util/browser_distribution.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 entries->push_back(new RegistryEntry( 292 entries->push_back(new RegistryEntry(
294 prog_id_path + ShellUtil::kRegDefaultIcon, 293 prog_id_path + ShellUtil::kRegDefaultIcon,
295 ShellUtil::FormatIconLocation(app_info.file_type_icon_path, 294 ShellUtil::FormatIconLocation(app_info.file_type_icon_path,
296 app_info.file_type_icon_index))); 295 app_info.file_type_icon_index)));
297 entries->push_back(new RegistryEntry(prog_id_path + ShellUtil::kRegShellOpen, 296 entries->push_back(new RegistryEntry(prog_id_path + ShellUtil::kRegShellOpen,
298 app_info.command_line)); 297 app_info.command_line));
299 if (!app_info.delegate_clsid.empty()) { 298 if (!app_info.delegate_clsid.empty()) {
300 entries->push_back(new RegistryEntry( 299 entries->push_back(new RegistryEntry(
301 prog_id_path + ShellUtil::kRegShellOpen, ShellUtil::kRegDelegateExecute, 300 prog_id_path + ShellUtil::kRegShellOpen, ShellUtil::kRegDelegateExecute,
302 app_info.delegate_clsid)); 301 app_info.delegate_clsid));
303 // If Metro is not supported, remove the DelegateExecute entry instead of 302 entries->back()->set_removal_flag(RegistryEntry::RemovalFlag::VALUE);
gab 2016/01/12 21:11:04 This code could be simplified. Only reason to intr
scottmg 2016/01/13 20:48:16 Done. I don't fully understand the code, or when i
304 // adding it.
305 if (!base::win::IsChromeMetroSupported())
306 entries->back()->set_removal_flag(RegistryEntry::RemovalFlag::VALUE);
307 } 303 }
308 304
309 // The following entries are required as of Windows 8, but do not 305 // The following entries are required as of Windows 8, but do not
310 // depend on the DelegateExecute verb handler being set. 306 // depend on the DelegateExecute verb handler being set.
311 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { 307 if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
312 if (!app_info.app_id.empty()) { 308 if (!app_info.app_id.empty()) {
313 entries->push_back(new RegistryEntry( 309 entries->push_back(new RegistryEntry(
314 prog_id_path, ShellUtil::kRegAppUserModelId, app_info.app_id)); 310 prog_id_path, ShellUtil::kRegAppUserModelId, app_info.app_id));
315 } 311 }
316 312
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 app_info.application_description = dist->GetAppDescription(); 370 app_info.application_description = dist->GetAppDescription();
375 app_info.publisher_name = dist->GetPublisherName(); 371 app_info.publisher_name = dist->GetPublisherName();
376 372
377 app_info.delegate_clsid = dist->GetCommandExecuteImplClsid(); 373 app_info.delegate_clsid = dist->GetCommandExecuteImplClsid();
378 374
379 GetProgIdEntries(app_info, entries); 375 GetProgIdEntries(app_info, entries);
380 376
381 if (!app_info.delegate_clsid.empty()) { 377 if (!app_info.delegate_clsid.empty()) {
382 ScopedVector<RegistryEntry> delegate_execute_entries = 378 ScopedVector<RegistryEntry> delegate_execute_entries =
383 GetChromeDelegateExecuteEntries(chrome_exe, app_info); 379 GetChromeDelegateExecuteEntries(chrome_exe, app_info);
384 if (!base::win::IsChromeMetroSupported()) { 380 // Remove the keys (not only their values) so that Windows will continue
gab 2016/01/12 21:11:04 Ditto here: add TODO
scottmg 2016/01/13 20:48:16 Done.
385 // Remove the keys (not only their values) so that Windows will continue 381 // to launch Chrome without a pesky association error.
386 // to launch Chrome without a pesky association error. 382 for (RegistryEntry* entry : delegate_execute_entries)
387 for (RegistryEntry* entry : delegate_execute_entries) 383 entry->set_removal_flag(RegistryEntry::RemovalFlag::KEY);
388 entry->set_removal_flag(RegistryEntry::RemovalFlag::KEY);
389 }
390 // Move |delegate_execute_entries| to |entries|. 384 // Move |delegate_execute_entries| to |entries|.
391 entries->insert(entries->end(), delegate_execute_entries.begin(), 385 entries->insert(entries->end(), delegate_execute_entries.begin(),
392 delegate_execute_entries.end()); 386 delegate_execute_entries.end());
393 delegate_execute_entries.weak_clear(); 387 delegate_execute_entries.weak_clear();
394 } 388 }
395 } 389 }
396 390
397 // This method returns a list of the registry entries needed to declare a 391 // This method returns a list of the registry entries needed to declare a
398 // capability of handling a protocol on Windows. 392 // capability of handling a protocol on Windows.
399 void GetProtocolCapabilityEntries(BrowserDistribution* dist, 393 void GetProtocolCapabilityEntries(BrowserDistribution* dist,
(...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after
2337 itr != entries.end(); ++itr) 2331 itr != entries.end(); ++itr)
2338 (*itr)->AddToWorkItemList(root, items.get()); 2332 (*itr)->AddToWorkItemList(root, items.get());
2339 2333
2340 // Apply all the registry changes and if there is a problem, rollback 2334 // Apply all the registry changes and if there is a problem, rollback
2341 if (!items->Do()) { 2335 if (!items->Do()) {
2342 items->Rollback(); 2336 items->Rollback();
2343 return false; 2337 return false;
2344 } 2338 }
2345 return true; 2339 return true;
2346 } 2340 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698