Remove existing Skia suppressions
[chromium-blink-merge.git] / win8 / delegate_execute / delegate_execute_operation.cc
blob277b74b407b87a93d80cad9959dd265e9fdf9259
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
3 // found in the LICENSE file.
5 #include "win8/delegate_execute/delegate_execute_operation.h"
7 #include "base/command_line.h"
8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_split.h"
10 #include "base/win/windows_version.h"
11 #include "chrome/common/chrome_switches.h"
12 #include "win8/delegate_execute/delegate_execute_util.h"
14 namespace delegate_execute {
16 DelegateExecuteOperation::DelegateExecuteOperation()
17 : operation_type_(DELEGATE_EXECUTE) {
20 DelegateExecuteOperation::~DelegateExecuteOperation() {
23 bool DelegateExecuteOperation::Init(const base::CommandLine* cmd_line) {
24 if (base::win::GetVersion() >= base::win::VERSION_WIN7) {
25 base::FilePath shortcut(
26 cmd_line->GetSwitchValuePath(switches::kRelaunchShortcut));
27 // On Windows 7 the command line coming in may not have a path to the
28 // shortcut to launch Chrome. We ignore the shortcut and just do a regular
29 // ShellExecute of chrome.exe in this case.
30 if (shortcut.empty() &&
31 base::win::GetVersion() >= base::win::VERSION_WIN8) {
32 operation_type_ = DELEGATE_EXECUTE;
33 return true;
35 relaunch_shortcut_ = shortcut;
37 mutex_ = cmd_line->GetSwitchValueNative(switches::kWaitForMutex);
38 if (mutex_.empty())
39 return false;
40 // Add the mode forcing flags, if any.
41 const char* the_switch = NULL;
43 if (cmd_line->HasSwitch(switches::kForceDesktop))
44 the_switch = switches::kForceDesktop;
45 else if (cmd_line->HasSwitch(switches::kForceImmersive))
46 the_switch = switches::kForceImmersive;
48 relaunch_flags_ = ParametersFromSwitch(the_switch);
50 operation_type_ = RELAUNCH_CHROME;
51 return true;
54 base::Process DelegateExecuteOperation::GetParent() const {
55 std::vector<base::string16> parts;
56 base::SplitString(mutex_, L'.', &parts);
57 if (parts.size() != 3)
58 return base::Process();
59 DWORD pid;
60 if (!base::StringToUint(parts[2], reinterpret_cast<uint32*>(&pid)))
61 return base::Process();
62 return base::Process::Open(pid);
65 } // namespace delegate_execute