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

Side by Side Diff: apps/app_launch_for_metro_restart_win.cc

Issue 14061020: apps: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 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 "apps/app_launch_for_metro_restart_win.h" 5 #include "apps/app_launch_for_metro_restart_win.h"
6 6
7 #include "apps/pref_names.h" 7 #include "apps/pref_names.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.h" 10 #include "base/message_loop.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 prefs->ClearPref(prefs::kAppLaunchForMetroRestart); 69 prefs->ClearPref(prefs::kAppLaunchForMetroRestart);
70 70
71 if (win8::IsSingleWindowMetroMode()) { 71 if (win8::IsSingleWindowMetroMode()) {
72 // In this case we have relaunched with the correct profile, but we are not 72 // In this case we have relaunched with the correct profile, but we are not
73 // in Desktop mode, so can not launch apps. Leave the preferences cleared so 73 // in Desktop mode, so can not launch apps. Leave the preferences cleared so
74 // there are no surprises later. 74 // there are no surprises later.
75 return; 75 return;
76 } 76 }
77 77
78 const int kRestartAppLaunchDelayMs = 1000; 78 const int kRestartAppLaunchDelayMs = 1000;
79 MessageLoop::current()->PostDelayedTask( 79 base::MessageLoop::current()->PostDelayedTask(
80 FROM_HERE, 80 FROM_HERE,
81 base::Bind(&LaunchAppWithId, 81 base::Bind(&LaunchAppWithId, profile, extension_id),
82 profile,
83 extension_id),
84 base::TimeDelta::FromMilliseconds(kRestartAppLaunchDelayMs)); 82 base::TimeDelta::FromMilliseconds(kRestartAppLaunchDelayMs));
85 } 83 }
86 84
87 void SetAppLaunchForMetroRestart(Profile* profile, 85 void SetAppLaunchForMetroRestart(Profile* profile,
88 const std::string& extension_id) { 86 const std::string& extension_id) {
89 PrefService* prefs = g_browser_process->local_state(); 87 PrefService* prefs = g_browser_process->local_state();
90 prefs->SetString(prefs::kAppLaunchForMetroRestartProfile, 88 prefs->SetString(prefs::kAppLaunchForMetroRestartProfile,
91 profile->GetPath().BaseName().MaybeAsASCII()); 89 profile->GetPath().BaseName().MaybeAsASCII());
92 prefs->SetString(prefs::kAppLaunchForMetroRestart, extension_id); 90 prefs->SetString(prefs::kAppLaunchForMetroRestart, extension_id);
93 } 91 }
94 92
95 } // namespace apps 93 } // namespace apps
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698