| OLD | NEW |
| 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 "chrome/browser/process_singleton.h" | 5 #include "chrome/browser/process_singleton.h" |
| 6 | 6 |
| 7 #include <shellapi.h> | 7 #include <shellapi.h> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "chrome/common/chrome_paths_internal.h" | 31 #include "chrome/common/chrome_paths_internal.h" |
| 32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 33 #include "chrome/installer/util/wmi.h" | 33 #include "chrome/installer/util/wmi.h" |
| 34 #include "content/public/common/result_codes.h" | 34 #include "content/public/common/result_codes.h" |
| 35 #include "grit/chromium_strings.h" | 35 #include "grit/chromium_strings.h" |
| 36 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
| 37 #include "net/base/escape.h" | 37 #include "net/base/escape.h" |
| 38 #include "ui/base/l10n/l10n_util.h" | 38 #include "ui/base/l10n/l10n_util.h" |
| 39 #include "ui/base/win/hwnd_util.h" | 39 #include "ui/base/win/hwnd_util.h" |
| 40 | 40 |
| 41 #if defined(USE_AURA) | |
| 42 #include "chrome/browser/browser_process_platform_part_aurawin.h" | |
| 43 #else | |
| 44 #include "chrome/browser/browser_process_platform_part.h" | |
| 45 #endif | |
| 46 | |
| 47 namespace { | 41 namespace { |
| 48 | 42 |
| 49 const char kLockfile[] = "lockfile"; | 43 const char kLockfile[] = "lockfile"; |
| 50 | 44 |
| 51 const char kSearchUrl[] = | 45 const char kSearchUrl[] = |
| 52 "http://www.google.com/search?q=%s&sourceid=chrome&ie=UTF-8"; | 46 "http://www.google.com/search?q=%s&sourceid=chrome&ie=UTF-8"; |
| 53 | 47 |
| 54 const int kMetroChromeActivationTimeoutMs = 3000; | 48 const int kMetroChromeActivationTimeoutMs = 3000; |
| 55 | 49 |
| 56 // A helper class that acquires the given |mutex| while the AutoLockMutex is in | 50 // A helper class that acquires the given |mutex| while the AutoLockMutex is in |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 return PROCESS_NONE; | 399 return PROCESS_NONE; |
| 406 } | 400 } |
| 407 | 401 |
| 408 ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessOrCreate() { | 402 ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessOrCreate() { |
| 409 ProcessSingleton::NotifyResult result = PROCESS_NONE; | 403 ProcessSingleton::NotifyResult result = PROCESS_NONE; |
| 410 if (!Create()) { | 404 if (!Create()) { |
| 411 result = NotifyOtherProcess(); | 405 result = NotifyOtherProcess(); |
| 412 if (result == PROCESS_NONE) | 406 if (result == PROCESS_NONE) |
| 413 result = PROFILE_IN_USE; | 407 result = PROFILE_IN_USE; |
| 414 } else { | 408 } else { |
| 415 g_browser_process->platform_part()->PlatformSpecificCommandLineProcessing( | 409 g_browser_process->PlatformSpecificCommandLineProcessing( |
| 416 *CommandLine::ForCurrentProcess()); | 410 *CommandLine::ForCurrentProcess()); |
| 417 } | 411 } |
| 418 return result; | 412 return result; |
| 419 } | 413 } |
| 420 | 414 |
| 421 // Look for a Chrome instance that uses the same profile directory. If there | 415 // Look for a Chrome instance that uses the same profile directory. If there |
| 422 // isn't one, create a message window with its title set to the profile | 416 // isn't one, create a message window with its title set to the profile |
| 423 // directory path. | 417 // directory path. |
| 424 bool ProcessSingleton::Create() { | 418 bool ProcessSingleton::Create() { |
| 425 static const wchar_t kMutexName[] = L"Local\\ChromeProcessSingletonStartup!"; | 419 static const wchar_t kMutexName[] = L"Local\\ChromeProcessSingletonStartup!"; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 switch (message) { | 563 switch (message) { |
| 570 case WM_COPYDATA: | 564 case WM_COPYDATA: |
| 571 return OnCopyData(reinterpret_cast<HWND>(wparam), | 565 return OnCopyData(reinterpret_cast<HWND>(wparam), |
| 572 reinterpret_cast<COPYDATASTRUCT*>(lparam)); | 566 reinterpret_cast<COPYDATASTRUCT*>(lparam)); |
| 573 default: | 567 default: |
| 574 break; | 568 break; |
| 575 } | 569 } |
| 576 | 570 |
| 577 return ::DefWindowProc(hwnd, message, wparam, lparam); | 571 return ::DefWindowProc(hwnd, message, wparam, lparam); |
| 578 } | 572 } |
| OLD | NEW |