OLD | NEW |
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/chrome_process_finder_win.h" | 5 #include "chrome/browser/chrome_process_finder_win.h" |
6 | 6 |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 if (!thread_id || !process_id) | 112 if (!thread_id || !process_id) |
113 return NOTIFY_FAILED; | 113 return NOTIFY_FAILED; |
114 | 114 |
115 #if !defined(USE_AURA) | 115 #if !defined(USE_AURA) |
116 if (base::win::IsMetroProcess()) { | 116 if (base::win::IsMetroProcess()) { |
117 // Interesting corner case. We are launched as a metro process but we | 117 // Interesting corner case. We are launched as a metro process but we |
118 // found another chrome running. Since metro enforces single instance then | 118 // found another chrome running. Since metro enforces single instance then |
119 // the other chrome must be desktop chrome and this must be a search charm | 119 // the other chrome must be desktop chrome and this must be a search charm |
120 // activation. This scenario is unique; other cases should be properly | 120 // activation. This scenario is unique; other cases should be properly |
121 // handled by the delegate_execute which will not activate a second chrome. | 121 // handled by the delegate_execute which will not activate a second chrome. |
122 string16 terms; | 122 base::string16 terms; |
123 base::win::MetroLaunchType launch = base::win::GetMetroLaunchParams(&terms); | 123 base::win::MetroLaunchType launch = base::win::GetMetroLaunchParams(&terms); |
124 if (launch != base::win::METRO_SEARCH) { | 124 if (launch != base::win::METRO_SEARCH) { |
125 LOG(WARNING) << "In metro mode, but and launch is " << launch; | 125 LOG(WARNING) << "In metro mode, but and launch is " << launch; |
126 } else { | 126 } else { |
127 std::string query = EscapeQueryParamValue(UTF16ToUTF8(terms), true); | 127 std::string query = EscapeQueryParamValue(UTF16ToUTF8(terms), true); |
128 std::string url = base::StringPrintf(kSearchUrl, query.c_str()); | 128 std::string url = base::StringPrintf(kSearchUrl, query.c_str()); |
129 SHELLEXECUTEINFOA sei = { sizeof(sei) }; | 129 SHELLEXECUTEINFOA sei = { sizeof(sei) }; |
130 sei.fMask = SEE_MASK_FLAG_LOG_USAGE; | 130 sei.fMask = SEE_MASK_FLAG_LOG_USAGE; |
131 sei.nShow = SW_SHOWNORMAL; | 131 sei.nShow = SW_SHOWNORMAL; |
132 sei.lpFile = url.c_str(); | 132 sei.lpFile = url.c_str(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 192 |
193 // It is possible that the process owning this window may have died by now. | 193 // It is possible that the process owning this window may have died by now. |
194 if (!::IsWindow(remote_window)) | 194 if (!::IsWindow(remote_window)) |
195 return NOTIFY_FAILED; | 195 return NOTIFY_FAILED; |
196 | 196 |
197 // If the window couldn't be notified but still exists, assume it is hung. | 197 // If the window couldn't be notified but still exists, assume it is hung. |
198 return NOTIFY_WINDOW_HUNG; | 198 return NOTIFY_WINDOW_HUNG; |
199 } | 199 } |
200 | 200 |
201 } // namespace chrome | 201 } // namespace chrome |
OLD | NEW |