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

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

Issue 258243002: Support "Pin to taskbar" for hosted app windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/files/file_enumerator.h" 11 #include "base/files/file_enumerator.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/md5.h" 13 #include "base/md5.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/strings/string_piece.h" 15 #include "base/strings/string_piece.h"
16 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "base/win/shortcut.h" 18 #include "base/win/shortcut.h"
19 #include "base/win/windows_version.h" 19 #include "base/win/windows_version.h"
20 #include "chrome/browser/web_applications/update_relaunch_details_worker_win.h"
20 #include "chrome/browser/web_applications/update_shortcut_worker_win.h" 21 #include "chrome/browser/web_applications/update_shortcut_worker_win.h"
21 #include "chrome/browser/web_applications/web_app.h" 22 #include "chrome/browser/web_applications/web_app.h"
22 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
23 #include "chrome/installer/util/browser_distribution.h" 24 #include "chrome/installer/util/browser_distribution.h"
24 #include "chrome/installer/util/shell_util.h" 25 #include "chrome/installer/util/shell_util.h"
25 #include "chrome/installer/util/util_constants.h" 26 #include "chrome/installer/util/util_constants.h"
26 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
27 #include "ui/gfx/icon_util.h" 28 #include "ui/gfx/icon_util.h"
28 #include "ui/gfx/image/image.h" 29 #include "ui/gfx/image/image.h"
29 #include "ui/gfx/image/image_family.h" 30 #include "ui/gfx/image/image_family.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 DCHECK_EQ(out_filenames.size(), 1u); 347 DCHECK_EQ(out_filenames.size(), 1u);
347 DCHECK_EQ(out_filenames[0].value(), web_app_dir_shortcut.value()); 348 DCHECK_EQ(out_filenames[0].value(), web_app_dir_shortcut.value());
348 } else { 349 } else {
349 internals::CheckAndSaveIcon( 350 internals::CheckAndSaveIcon(
350 internals::GetIconFilePath(web_app_dir, shortcut_info.title), 351 internals::GetIconFilePath(web_app_dir, shortcut_info.title),
351 shortcut_info.favicon); 352 shortcut_info.favicon);
352 } 353 }
353 return web_app_dir_shortcut; 354 return web_app_dir_shortcut;
354 } 355 }
355 356
357 void UpdateRelaunchDetailsForApp(Profile* profile,
358 const extensions::Extension* extension,
359 HWND hwnd) {
360 // The worker will delete itself on completion.
361 UpdateRelaunchDetailsWorker* worker =
jackhou1 2014/04/29 08:50:18 You can new UpdateRelaunchDetailsWorker(profile, e
calamity 2014/05/19 06:11:54 No longer applicable.
362 new UpdateRelaunchDetailsWorker(profile, extension, hwnd);
363 worker->Run();
364 }
365
356 namespace internals { 366 namespace internals {
357 367
358 // Saves |image| to |icon_file| if the file is outdated and refresh shell's 368 // Saves |image| to |icon_file| if the file is outdated and refresh shell's
359 // icon cache to ensure correct icon is displayed. Returns true if icon_file 369 // icon cache to ensure correct icon is displayed. Returns true if icon_file
360 // is up to date or successfully updated. 370 // is up to date or successfully updated.
361 bool CheckAndSaveIcon(const base::FilePath& icon_file, 371 bool CheckAndSaveIcon(const base::FilePath& icon_file,
362 const gfx::ImageFamily& image) { 372 const gfx::ImageFamily& image) {
363 if (ShouldUpdateIcon(icon_file, image)) { 373 if (ShouldUpdateIcon(icon_file, image)) {
364 if (SaveIconWithCheckSum(icon_file, image)) { 374 if (SaveIconWithCheckSum(icon_file, image)) {
365 // Refresh shell's icon cache. This call is quite disruptive as user would 375 // Refresh shell's icon cache. This call is quite disruptive as user would
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 559
550 } // namespace internals 560 } // namespace internals
551 561
552 void UpdateShortcutForTabContents(content::WebContents* web_contents) { 562 void UpdateShortcutForTabContents(content::WebContents* web_contents) {
553 // UpdateShortcutWorker will delete itself when it's done. 563 // UpdateShortcutWorker will delete itself when it's done.
554 UpdateShortcutWorker* worker = new UpdateShortcutWorker(web_contents); 564 UpdateShortcutWorker* worker = new UpdateShortcutWorker(web_contents);
555 worker->Run(); 565 worker->Run();
556 } 566 }
557 567
558 } // namespace web_app 568 } // namespace web_app
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698