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

Side by Side Diff: chrome/browser/web_applications/web_app_win.cc

Issue 2909943003: Removing useless Win7 checks + standardize its use (Closed)
Patch Set: Various nits Created 3 years, 6 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 #include "chrome/browser/web_applications/web_app_win.h" 5 #include "chrome/browser/web_applications/web_app_win.h"
6 6
7 #include <shlobj.h> 7 #include <shlobj.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/files/file_enumerator.h" 13 #include "base/files/file_enumerator.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/md5.h" 17 #include "base/md5.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
20 #include "base/strings/string_piece.h" 20 #include "base/strings/string_piece.h"
21 #include "base/strings/stringprintf.h" 21 #include "base/strings/stringprintf.h"
22 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
23 #include "base/task_scheduler/post_task.h" 23 #include "base/task_scheduler/post_task.h"
24 #include "base/win/shortcut.h" 24 #include "base/win/shortcut.h"
25 #include "base/win/windows_version.h"
26 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/shell_integration_win.h" 26 #include "chrome/browser/shell_integration_win.h"
28 #include "chrome/browser/web_applications/update_shortcut_worker_win.h" 27 #include "chrome/browser/web_applications/update_shortcut_worker_win.h"
29 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
30 #include "chrome/installer/util/browser_distribution.h" 29 #include "chrome/installer/util/browser_distribution.h"
31 #include "chrome/installer/util/shell_util.h" 30 #include "chrome/installer/util/shell_util.h"
32 #include "chrome/installer/util/util_constants.h" 31 #include "chrome/installer/util/util_constants.h"
33 #include "content/public/browser/browser_thread.h" 32 #include "content/public/browser/browser_thread.h"
34 #include "extensions/common/extension.h" 33 #include "extensions/common/extension.h"
35 #include "ui/base/win/shell.h" 34 #include "ui/base/win/shell.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 web_app::ShortcutLocations all_shortcut_locations; 292 web_app::ShortcutLocations all_shortcut_locations;
294 all_shortcut_locations.in_quick_launch_bar = true; 293 all_shortcut_locations.in_quick_launch_bar = true;
295 all_shortcut_locations.on_desktop = true; 294 all_shortcut_locations.on_desktop = true;
296 // Delete shortcuts from the Chrome Apps subdirectory. 295 // Delete shortcuts from the Chrome Apps subdirectory.
297 // This matches the subdir name set by CreateApplicationShortcutView::Accept 296 // This matches the subdir name set by CreateApplicationShortcutView::Accept
298 // for Chrome apps (not URL apps, but this function does not apply for them). 297 // for Chrome apps (not URL apps, but this function does not apply for them).
299 all_shortcut_locations.applications_menu_location = 298 all_shortcut_locations.applications_menu_location =
300 web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS; 299 web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS;
301 std::vector<base::FilePath> all_paths = web_app::internals::GetShortcutPaths( 300 std::vector<base::FilePath> all_paths = web_app::internals::GetShortcutPaths(
302 all_shortcut_locations); 301 all_shortcut_locations);
303 if (base::win::GetVersion() >= base::win::VERSION_WIN7 && 302 if (!web_app_path.empty())
304 !web_app_path.empty()) {
305 all_paths.push_back(web_app_path); 303 all_paths.push_back(web_app_path);
306 }
307 304
308 if (was_pinned_to_taskbar) { 305 if (was_pinned_to_taskbar) {
309 // Determine if there is a link to this app in the TaskBar pin directory. 306 // Determine if there is a link to this app in the TaskBar pin directory.
310 base::FilePath taskbar_pin_path; 307 base::FilePath taskbar_pin_path;
311 if (PathService::Get(base::DIR_TASKBAR_PINS, &taskbar_pin_path)) { 308 if (PathService::Get(base::DIR_TASKBAR_PINS, &taskbar_pin_path)) {
312 std::vector<base::FilePath> taskbar_pin_files = 309 std::vector<base::FilePath> taskbar_pin_files =
313 FindAppShortcutsByProfileAndTitle(taskbar_pin_path, profile_path, 310 FindAppShortcutsByProfileAndTitle(taskbar_pin_path, profile_path,
314 title); 311 title);
315 *was_pinned_to_taskbar = !taskbar_pin_files.empty(); 312 *was_pinned_to_taskbar = !taskbar_pin_files.empty();
316 } else { 313 } else {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 606
610 } // namespace internals 607 } // namespace internals
611 608
612 void UpdateShortcutForTabContents(content::WebContents* web_contents) { 609 void UpdateShortcutForTabContents(content::WebContents* web_contents) {
613 // UpdateShortcutWorker will delete itself when it's done. 610 // UpdateShortcutWorker will delete itself when it's done.
614 UpdateShortcutWorker* worker = new UpdateShortcutWorker(web_contents); 611 UpdateShortcutWorker* worker = new UpdateShortcutWorker(web_contents);
615 worker->Run(); 612 worker->Run();
616 } 613 }
617 614
618 } // namespace web_app 615 } // namespace web_app
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698