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

Side by Side Diff: chrome/browser/apps/app_launch_for_metro_restart_win.cc

Issue 2033753002: Remove use of deprecated MessageLoop methods in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: manual change Created 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/apps/app_launch_for_metro_restart_win.h" 5 #include "chrome/browser/apps/app_launch_for_metro_restart_win.h"
6 6
7 #include "apps/launcher.h" 7 #include "apps/launcher.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/location.h"
11 #include "base/single_thread_task_runner.h"
12 #include "base/threading/thread_task_runner_handle.h"
11 #include "base/time/time.h" 13 #include "base/time/time.h"
12 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
17 #include "components/prefs/pref_registry_simple.h" 19 #include "components/prefs/pref_registry_simple.h"
18 #include "components/prefs/pref_service.h" 20 #include "components/prefs/pref_service.h"
19 #include "extensions/browser/api/app_runtime/app_runtime_api.h" 21 #include "extensions/browser/api/app_runtime/app_runtime_api.h"
20 #include "extensions/browser/extension_system.h" 22 #include "extensions/browser/extension_system.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 if (!prefs->HasPrefPath(prefs::kAppLaunchForMetroRestart)) 67 if (!prefs->HasPrefPath(prefs::kAppLaunchForMetroRestart))
66 return; 68 return;
67 69
68 std::string extension_id = prefs->GetString(prefs::kAppLaunchForMetroRestart); 70 std::string extension_id = prefs->GetString(prefs::kAppLaunchForMetroRestart);
69 if (extension_id.empty()) 71 if (extension_id.empty())
70 return; 72 return;
71 73
72 prefs->ClearPref(prefs::kAppLaunchForMetroRestart); 74 prefs->ClearPref(prefs::kAppLaunchForMetroRestart);
73 75
74 const int kRestartAppLaunchDelayMs = 1000; 76 const int kRestartAppLaunchDelayMs = 1000;
75 base::MessageLoop::current()->PostDelayedTask( 77 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
76 FROM_HERE, 78 FROM_HERE, base::Bind(&LaunchAppWithId, profile, extension_id),
77 base::Bind(&LaunchAppWithId, profile, extension_id),
78 base::TimeDelta::FromMilliseconds(kRestartAppLaunchDelayMs)); 79 base::TimeDelta::FromMilliseconds(kRestartAppLaunchDelayMs));
79 } 80 }
80 81
81 void SetAppLaunchForMetroRestart(Profile* profile, 82 void SetAppLaunchForMetroRestart(Profile* profile,
82 const std::string& extension_id) { 83 const std::string& extension_id) {
83 PrefService* prefs = g_browser_process->local_state(); 84 PrefService* prefs = g_browser_process->local_state();
84 prefs->SetString(prefs::kAppLaunchForMetroRestartProfile, 85 prefs->SetString(prefs::kAppLaunchForMetroRestartProfile,
85 profile->GetPath().BaseName().MaybeAsASCII()); 86 profile->GetPath().BaseName().MaybeAsASCII());
86 prefs->SetString(prefs::kAppLaunchForMetroRestart, extension_id); 87 prefs->SetString(prefs::kAppLaunchForMetroRestart, extension_id);
87 } 88 }
88 89
89 void RegisterPrefs(PrefRegistrySimple* registry) { 90 void RegisterPrefs(PrefRegistrySimple* registry) {
90 registry->RegisterStringPref(prefs::kAppLaunchForMetroRestart, ""); 91 registry->RegisterStringPref(prefs::kAppLaunchForMetroRestart, "");
91 registry->RegisterStringPref(prefs::kAppLaunchForMetroRestartProfile, ""); 92 registry->RegisterStringPref(prefs::kAppLaunchForMetroRestartProfile, "");
92 } 93 }
93 94
94 } // namespace app_metro_launch 95 } // namespace app_metro_launch
OLDNEW
« no previous file with comments | « chrome/browser/android/feedback/connectivity_checker.cc ('k') | chrome/browser/apps/app_shim/app_shim_handler_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698