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

Side by Side Diff: chrome/browser/web_applications/web_app_mac.mm

Issue 329253002: Revert of [Mac] Add interactive App Shim test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/web_applications/web_app_mac.h ('k') | chrome/chrome_tests.gypi » ('j') | 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 #import "chrome/browser/web_applications/web_app_mac.h" 5 #import "chrome/browser/web_applications/web_app_mac.h"
6 6
7 #import <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 29 matching lines...) Expand all
40 #include "grit/chromium_strings.h" 40 #include "grit/chromium_strings.h"
41 #include "grit/generated_resources.h" 41 #include "grit/generated_resources.h"
42 #import "skia/ext/skia_utils_mac.h" 42 #import "skia/ext/skia_utils_mac.h"
43 #include "third_party/skia/include/core/SkBitmap.h" 43 #include "third_party/skia/include/core/SkBitmap.h"
44 #include "third_party/skia/include/core/SkColor.h" 44 #include "third_party/skia/include/core/SkColor.h"
45 #include "ui/base/l10n/l10n_util.h" 45 #include "ui/base/l10n/l10n_util.h"
46 #import "ui/base/l10n/l10n_util_mac.h" 46 #import "ui/base/l10n/l10n_util_mac.h"
47 #include "ui/base/resource/resource_bundle.h" 47 #include "ui/base/resource/resource_bundle.h"
48 #include "ui/gfx/image/image_family.h" 48 #include "ui/gfx/image/image_family.h"
49 49
50 bool g_app_shims_allow_update_and_launch_in_tests = false;
51
52 namespace { 50 namespace {
53 51
54 // Launch Services Key to run as an agent app, which doesn't launch in the dock. 52 // Launch Services Key to run as an agent app, which doesn't launch in the dock.
55 NSString* const kLSUIElement = @"LSUIElement"; 53 NSString* const kLSUIElement = @"LSUIElement";
56 54
57 class ScopedCarbonHandle { 55 class ScopedCarbonHandle {
58 public: 56 public:
59 ScopedCarbonHandle(size_t initial_size) : handle_(NewHandle(initial_size)) { 57 ScopedCarbonHandle(size_t initial_size) : handle_(NewHandle(initial_size)) {
60 DCHECK(handle_); 58 DCHECK(handle_);
61 DCHECK_EQ(noErr, MemError()); 59 DCHECK_EQ(noErr, MemError());
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 inFileViewerRootedAtPath:nil]; 850 inFileViewerRootedAtPath:nil];
853 } 851 }
854 852
855 base::FilePath GetAppInstallPath(const ShortcutInfo& shortcut_info) { 853 base::FilePath GetAppInstallPath(const ShortcutInfo& shortcut_info) {
856 WebAppShortcutCreator shortcut_creator( 854 WebAppShortcutCreator shortcut_creator(
857 base::FilePath(), shortcut_info, extensions::FileHandlersInfo()); 855 base::FilePath(), shortcut_info, extensions::FileHandlersInfo());
858 return shortcut_creator.GetApplicationsShortcutPath(); 856 return shortcut_creator.GetApplicationsShortcutPath();
859 } 857 }
860 858
861 void MaybeLaunchShortcut(const ShortcutInfo& shortcut_info) { 859 void MaybeLaunchShortcut(const ShortcutInfo& shortcut_info) {
862 if (AppShimsDisabledForTest() && 860 if (AppShimsDisabledForTest())
863 !g_app_shims_allow_update_and_launch_in_tests) {
864 return; 861 return;
865 }
866 862
867 content::BrowserThread::PostTask( 863 content::BrowserThread::PostTask(
868 content::BrowserThread::FILE, FROM_HERE, 864 content::BrowserThread::FILE, FROM_HERE,
869 base::Bind(&LaunchShimOnFileThread, shortcut_info)); 865 base::Bind(&LaunchShimOnFileThread, shortcut_info));
870 } 866 }
871 867
872 // Called when the app's ShortcutInfo (with icon) is loaded when creating app 868 // Called when the app's ShortcutInfo (with icon) is loaded when creating app
873 // shortcuts. 869 // shortcuts.
874 void CreateAppShortcutInfoLoaded( 870 void CreateAppShortcutInfoLoaded(
875 Profile* profile, 871 Profile* profile,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 app_data_path, shortcut_info, extensions::FileHandlersInfo()); 963 app_data_path, shortcut_info, extensions::FileHandlersInfo());
968 shortcut_creator.DeleteShortcuts(); 964 shortcut_creator.DeleteShortcuts();
969 } 965 }
970 966
971 void UpdatePlatformShortcuts( 967 void UpdatePlatformShortcuts(
972 const base::FilePath& app_data_path, 968 const base::FilePath& app_data_path,
973 const base::string16& old_app_title, 969 const base::string16& old_app_title,
974 const ShortcutInfo& shortcut_info, 970 const ShortcutInfo& shortcut_info,
975 const extensions::FileHandlersInfo& file_handlers_info) { 971 const extensions::FileHandlersInfo& file_handlers_info) {
976 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 972 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
977 if (AppShimsDisabledForTest() && 973 if (AppShimsDisabledForTest())
978 !g_app_shims_allow_update_and_launch_in_tests) {
979 return; 974 return;
980 }
981 975
982 WebAppShortcutCreator shortcut_creator( 976 WebAppShortcutCreator shortcut_creator(
983 app_data_path, shortcut_info, file_handlers_info); 977 app_data_path, shortcut_info, file_handlers_info);
984 shortcut_creator.UpdateShortcuts(); 978 shortcut_creator.UpdateShortcuts();
985 } 979 }
986 980
987 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) { 981 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) {
988 const std::string profile_base_name = profile_path.BaseName().value(); 982 const std::string profile_base_name = profile_path.BaseName().value();
989 std::vector<base::FilePath> bundles = GetAllAppBundlesInPath( 983 std::vector<base::FilePath> bundles = GetAllAppBundlesInPath(
990 profile_path.Append(chrome::kWebAppDirname), profile_base_name); 984 profile_path.Append(chrome::kWebAppDirname), profile_base_name);
(...skipping 22 matching lines...) Expand all
1013 web_app::UpdateShortcutInfoAndIconForApp( 1007 web_app::UpdateShortcutInfoAndIconForApp(
1014 app, 1008 app,
1015 profile, 1009 profile,
1016 base::Bind(&web_app::CreateAppShortcutInfoLoaded, 1010 base::Bind(&web_app::CreateAppShortcutInfoLoaded,
1017 profile, 1011 profile,
1018 app, 1012 app,
1019 close_callback)); 1013 close_callback));
1020 } 1014 }
1021 1015
1022 } // namespace chrome 1016 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/web_applications/web_app_mac.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698