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

Side by Side Diff: chrome/browser/chrome_process_finder_win.cc

Issue 17615003: ProcessSingleton now uses base::win::MessageWindow to create a message-only window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback. Created 7 years, 5 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 | « base/win/message_window_unittest.cc ('k') | chrome/browser/process_singleton.h » ('j') | 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 "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"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/process_info.h" 14 #include "base/process_info.h"
15 #include "base/process_util.h" 15 #include "base/process_util.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "base/win/message_window.h"
19 #include "base/win/metro.h" 20 #include "base/win/metro.h"
20 #include "base/win/scoped_handle.h" 21 #include "base/win/scoped_handle.h"
21 #include "base/win/win_util.h" 22 #include "base/win/win_util.h"
22 #include "base/win/windows_version.h" 23 #include "base/win/windows_version.h"
23 #include "chrome/browser/metro_utils/metro_chrome_win.h" 24 #include "chrome/browser/metro_utils/metro_chrome_win.h"
24 #include "chrome/common/chrome_constants.h" 25 #include "chrome/common/chrome_constants.h"
25 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
26 27
27 28
28 namespace { 29 namespace {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 0xffffffffL, 0xfc00987dL, 0x78000001L, 0xb8000001L, 87 0xffffffffL, 0xfc00987dL, 0x78000001L, 0xb8000001L,
87 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL 88 0xffffffffL, 0xffffffffL, 0xffffffffL, 0xffffffffL
88 }}; 89 }};
89 90
90 std::string EscapeQueryParamValue(const std::string& text, bool use_plus) { 91 std::string EscapeQueryParamValue(const std::string& text, bool use_plus) {
91 return Escape(text, kQueryCharmap, use_plus); 92 return Escape(text, kQueryCharmap, use_plus);
92 } 93 }
93 94
94 // END COPY from net/base/escape.cc 95 // END COPY from net/base/escape.cc
95 96
96 } 97 } // namespace
97 98
98 namespace chrome { 99 namespace chrome {
99 100
100 HWND FindRunningChromeWindow(const base::FilePath& user_data_dir) { 101 HWND FindRunningChromeWindow(const base::FilePath& user_data_dir) {
101 return FindWindowEx(HWND_MESSAGE, NULL, chrome::kMessageWindowClass, 102 return base::win::MessageWindow::FindWindow(user_data_dir.value());
102 user_data_dir.value().c_str());
103 } 103 }
104 104
105 NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window) { 105 NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window) {
106 DCHECK(remote_window); 106 DCHECK(remote_window);
107 static const char kSearchUrl[] = 107 static const char kSearchUrl[] =
108 "http://www.google.com/search?q=%s&sourceid=chrome&ie=UTF-8"; 108 "http://www.google.com/search?q=%s&sourceid=chrome&ie=UTF-8";
109 DWORD process_id = 0; 109 DWORD process_id = 0;
110 DWORD thread_id = GetWindowThreadProcessId(remote_window, &process_id); 110 DWORD thread_id = GetWindowThreadProcessId(remote_window, &process_id);
111 if (!thread_id || !process_id) 111 if (!thread_id || !process_id)
112 return NOTIFY_FAILED; 112 return NOTIFY_FAILED;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 182
183 // It is possible that the process owning this window may have died by now. 183 // It is possible that the process owning this window may have died by now.
184 if (!::IsWindow(remote_window)) 184 if (!::IsWindow(remote_window))
185 return NOTIFY_FAILED; 185 return NOTIFY_FAILED;
186 186
187 // If the window couldn't be notified but still exists, assume it is hung. 187 // If the window couldn't be notified but still exists, assume it is hung.
188 return NOTIFY_WINDOW_HUNG; 188 return NOTIFY_WINDOW_HUNG;
189 } 189 }
190 190
191 } // namespace chrome 191 } // namespace chrome
OLDNEW
« no previous file with comments | « base/win/message_window_unittest.cc ('k') | chrome/browser/process_singleton.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698