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

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

Issue 1095763003: [chrome/browser/web_applications] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « chrome/browser/web_applications/web_app_mac.mm ('k') | 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/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 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // |shortcut_paths| will be populated with a list of directories where shortcuts 280 // |shortcut_paths| will be populated with a list of directories where shortcuts
281 // for this app were found (and deleted). This will delete duplicate shortcuts, 281 // for this app were found (and deleted). This will delete duplicate shortcuts,
282 // but only return each path once, even if it contained multiple deleted 282 // but only return each path once, even if it contained multiple deleted
283 // shortcuts. Both of these may be NULL. 283 // shortcuts. Both of these may be NULL.
284 void GetShortcutLocationsAndDeleteShortcuts( 284 void GetShortcutLocationsAndDeleteShortcuts(
285 const base::FilePath& web_app_path, 285 const base::FilePath& web_app_path,
286 const base::FilePath& profile_path, 286 const base::FilePath& profile_path,
287 const base::string16& title, 287 const base::string16& title,
288 bool* was_pinned_to_taskbar, 288 bool* was_pinned_to_taskbar,
289 std::vector<base::FilePath>* shortcut_paths) { 289 std::vector<base::FilePath>* shortcut_paths) {
290 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 290 DCHECK(content::BrowserThread::FILE);
291 291
292 // Get all possible locations for shortcuts. 292 // Get all possible locations for shortcuts.
293 web_app::ShortcutLocations all_shortcut_locations; 293 web_app::ShortcutLocations all_shortcut_locations;
294 all_shortcut_locations.in_quick_launch_bar = true; 294 all_shortcut_locations.in_quick_launch_bar = true;
295 all_shortcut_locations.on_desktop = true; 295 all_shortcut_locations.on_desktop = true;
296 // Delete shortcuts from the Chrome Apps subdirectory. 296 // Delete shortcuts from the Chrome Apps subdirectory.
297 // This matches the subdir name set by CreateApplicationShortcutView::Accept 297 // This matches the subdir name set by CreateApplicationShortcutView::Accept
298 // for Chrome apps (not URL apps, but this function does not apply for them). 298 // for Chrome apps (not URL apps, but this function does not apply for them).
299 all_shortcut_locations.applications_menu_location = 299 all_shortcut_locations.applications_menu_location =
300 web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS; 300 web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS;
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 } 577 }
578 return true; 578 return true;
579 } 579 }
580 580
581 bool CreatePlatformShortcuts( 581 bool CreatePlatformShortcuts(
582 const base::FilePath& web_app_path, 582 const base::FilePath& web_app_path,
583 scoped_ptr<ShortcutInfo> shortcut_info, 583 scoped_ptr<ShortcutInfo> shortcut_info,
584 const extensions::FileHandlersInfo& file_handlers_info, 584 const extensions::FileHandlersInfo& file_handlers_info,
585 const ShortcutLocations& creation_locations, 585 const ShortcutLocations& creation_locations,
586 ShortcutCreationReason creation_reason) { 586 ShortcutCreationReason creation_reason) {
587 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 587 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
588 588
589 // Nothing to do on Windows for hidden apps. 589 // Nothing to do on Windows for hidden apps.
590 if (creation_locations.applications_menu_location == APP_MENU_LOCATION_HIDDEN) 590 if (creation_locations.applications_menu_location == APP_MENU_LOCATION_HIDDEN)
591 return true; 591 return true;
592 592
593 // Shortcut paths under which to create shortcuts. 593 // Shortcut paths under which to create shortcuts.
594 std::vector<base::FilePath> shortcut_paths = 594 std::vector<base::FilePath> shortcut_paths =
595 GetShortcutPaths(creation_locations); 595 GetShortcutPaths(creation_locations);
596 596
597 bool pin_to_taskbar = creation_locations.in_quick_launch_bar && 597 bool pin_to_taskbar = creation_locations.in_quick_launch_bar &&
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 } 629 }
630 630
631 return true; 631 return true;
632 } 632 }
633 633
634 void UpdatePlatformShortcuts( 634 void UpdatePlatformShortcuts(
635 const base::FilePath& web_app_path, 635 const base::FilePath& web_app_path,
636 const base::string16& old_app_title, 636 const base::string16& old_app_title,
637 scoped_ptr<ShortcutInfo> shortcut_info, 637 scoped_ptr<ShortcutInfo> shortcut_info,
638 const extensions::FileHandlersInfo& file_handlers_info) { 638 const extensions::FileHandlersInfo& file_handlers_info) {
639 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 639 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
640 640
641 // Generates file name to use with persisted ico and shortcut file. 641 // Generates file name to use with persisted ico and shortcut file.
642 base::FilePath file_name = 642 base::FilePath file_name =
643 web_app::internals::GetSanitizedFileName(shortcut_info->title); 643 web_app::internals::GetSanitizedFileName(shortcut_info->title);
644 644
645 if (old_app_title != shortcut_info->title) { 645 if (old_app_title != shortcut_info->title) {
646 // The app's title has changed. Delete all existing app shortcuts and 646 // The app's title has changed. Delete all existing app shortcuts and
647 // recreate them in any locations they already existed (but do not add them 647 // recreate them in any locations they already existed (but do not add them
648 // to locations where they do not currently exist). 648 // to locations where they do not currently exist).
649 bool was_pinned_to_taskbar; 649 bool was_pinned_to_taskbar;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 765
766 } // namespace internals 766 } // namespace internals
767 767
768 void UpdateShortcutForTabContents(content::WebContents* web_contents) { 768 void UpdateShortcutForTabContents(content::WebContents* web_contents) {
769 // UpdateShortcutWorker will delete itself when it's done. 769 // UpdateShortcutWorker will delete itself when it's done.
770 UpdateShortcutWorker* worker = new UpdateShortcutWorker(web_contents); 770 UpdateShortcutWorker* worker = new UpdateShortcutWorker(web_contents);
771 worker->Run(); 771 worker->Run();
772 } 772 }
773 773
774 } // namespace web_app 774 } // namespace web_app
OLDNEW
« no previous file with comments | « chrome/browser/web_applications/web_app_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698