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

Side by Side Diff: win8/delegate_execute/delegate_execute_operation.cc

Issue 10962023: Prefix Chrome switches with the switch prefix. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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
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 "win8/delegate_execute/delegate_execute_operation.h" 5 #include "win8/delegate_execute/delegate_execute_operation.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/utf_string_conversions.h"
10 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
11 12
13 namespace {
14
15 const wchar_t kSwitchPrefix[] = L"--";
16
17 } // namespace
18
12 namespace delegate_execute { 19 namespace delegate_execute {
13 20
14 DelegateExecuteOperation::DelegateExecuteOperation() 21 DelegateExecuteOperation::DelegateExecuteOperation()
15 : operation_type_(DELEGATE_EXECUTE), 22 : operation_type_(DELEGATE_EXECUTE) {
16 relaunch_flags_("") {
17 } 23 }
18 24
19 DelegateExecuteOperation::~DelegateExecuteOperation() { 25 DelegateExecuteOperation::~DelegateExecuteOperation() {
20 } 26 }
21 27
22 bool DelegateExecuteOperation::Init(const CommandLine* cmd_line) { 28 bool DelegateExecuteOperation::Init(const CommandLine* cmd_line) {
23 FilePath shortcut(cmd_line->GetSwitchValuePath(switches::kRelaunchShortcut)); 29 FilePath shortcut(cmd_line->GetSwitchValuePath(switches::kRelaunchShortcut));
24 if (shortcut.empty()) { 30 if (shortcut.empty()) {
25 operation_type_ = DELEGATE_EXECUTE; 31 operation_type_ = DELEGATE_EXECUTE;
26 return true; 32 return true;
27 } 33 }
28 relaunch_shortcut_ = shortcut; 34 relaunch_shortcut_ = shortcut;
29 mutex_ = cmd_line->GetSwitchValueNative(switches::kWaitForMutex); 35 mutex_ = cmd_line->GetSwitchValueNative(switches::kWaitForMutex);
30 if (mutex_.empty()) 36 if (mutex_.empty())
31 return false; 37 return false;
32 // Add the mode forcing flags, if any. 38 // Add the mode forcing flags, if any.
33 if (cmd_line->HasSwitch(switches::kForceDesktop)) 39 if (cmd_line->HasSwitch(switches::kForceDesktop))
34 relaunch_flags_ = switches::kForceDesktop; 40 relaunch_flags_ = kSwitchPrefix + ASCIIToWide(switches::kForceDesktop);
35 else if (cmd_line->HasSwitch(switches::kForceImmersive)) 41 else if (cmd_line->HasSwitch(switches::kForceImmersive))
36 relaunch_flags_ = switches::kForceImmersive; 42 relaunch_flags_ = kSwitchPrefix + ASCIIToWide(switches::kForceImmersive);
43 else
44 relaunch_flags_.clear();
37 45
38 operation_type_ = RELAUNCH_CHROME; 46 operation_type_ = RELAUNCH_CHROME;
39 return true; 47 return true;
40 } 48 }
41 49
42 DWORD DelegateExecuteOperation::GetParentPid() const { 50 DWORD DelegateExecuteOperation::GetParentPid() const {
43 std::vector<string16> parts; 51 std::vector<string16> parts;
44 base::SplitString(mutex_, L'.', &parts); 52 base::SplitString(mutex_, L'.', &parts);
45 if (parts.size() != 3) 53 if (parts.size() != 3)
46 return 0; 54 return 0;
47 DWORD pid; 55 DWORD pid;
48 if (!base::StringToUint(parts[2], reinterpret_cast<uint32*>(&pid))) 56 if (!base::StringToUint(parts[2], reinterpret_cast<uint32*>(&pid)))
49 return 0; 57 return 0;
50 return pid; 58 return pid;
51 } 59 }
52 60
53 } // namespace delegate_execute 61 } // namespace delegate_execute
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698