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 "content/public/browser/browser_main_runner.h" | 5 #include "content/public/browser/browser_main_runner.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/leak_annotations.h" | 9 #include "base/debug/leak_annotations.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
26 #include "base/win/win_util.h" | 26 #include "base/win/win_util.h" |
27 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
28 #include "net/cert/sha256_legacy_support_win.h" | 28 #include "net/cert/sha256_legacy_support_win.h" |
29 #include "sandbox/win/src/sidestep/preamble_patcher.h" | 29 #include "sandbox/win/src/sidestep/preamble_patcher.h" |
30 #include "ui/base/win/scoped_ole_initializer.h" | 30 #include "ui/base/win/scoped_ole_initializer.h" |
31 #include "ui/gfx/switches.h" | 31 #include "ui/gfx/switches.h" |
32 #include "ui/gfx/win/direct_write.h" | 32 #include "ui/gfx/win/direct_write.h" |
33 #endif | 33 #endif |
34 | 34 |
| 35 namespace content { |
| 36 |
| 37 namespace { |
| 38 |
35 bool g_exited_main_message_loop = false; | 39 bool g_exited_main_message_loop = false; |
36 | 40 |
37 namespace content { | |
38 | |
39 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
40 namespace { | |
41 | |
42 #if !defined(_WIN64) | 42 #if !defined(_WIN64) |
43 // Pointer to the original CryptVerifyCertificateSignatureEx function. | 43 // Pointer to the original CryptVerifyCertificateSignatureEx function. |
44 net::sha256_interception::CryptVerifyCertificateSignatureExFunc | 44 net::sha256_interception::CryptVerifyCertificateSignatureExFunc |
45 g_real_crypt_verify_signature_stub = NULL; | 45 g_real_crypt_verify_signature_stub = NULL; |
46 | 46 |
47 // Stub function that is called whenever the Crypt32 function | 47 // Stub function that is called whenever the Crypt32 function |
48 // CryptVerifyCertificateSignatureEx is called. It just defers to net to perform | 48 // CryptVerifyCertificateSignatureEx is called. It just defers to net to perform |
49 // the actual verification. | 49 // the actual verification. |
50 BOOL WINAPI CryptVerifyCertificateSignatureExStub( | 50 BOOL WINAPI CryptVerifyCertificateSignatureExStub( |
51 HCRYPTPROV_LEGACY provider, | 51 HCRYPTPROV_LEGACY provider, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 return; | 109 return; |
110 } | 110 } |
111 | 111 |
112 DWORD dummy = 0; | 112 DWORD dummy = 0; |
113 CHECK(::VirtualProtect(cert_verify_signature_ptr, 5, old_protect, &dummy)); | 113 CHECK(::VirtualProtect(cert_verify_signature_ptr, 5, old_protect, &dummy)); |
114 CHECK(::VirtualProtect(g_real_crypt_verify_signature_stub, | 114 CHECK(::VirtualProtect(g_real_crypt_verify_signature_stub, |
115 sidestep::kMaxPreambleStubSize, old_protect, | 115 sidestep::kMaxPreambleStubSize, old_protect, |
116 &old_protect)); | 116 &old_protect)); |
117 #endif // _WIN64 | 117 #endif // _WIN64 |
118 } | 118 } |
| 119 #endif // OS_WIN |
119 | 120 |
120 } // namespace | 121 } // namespace |
121 | 122 |
122 #endif // OS_WIN | |
123 | |
124 class BrowserMainRunnerImpl : public BrowserMainRunner { | 123 class BrowserMainRunnerImpl : public BrowserMainRunner { |
125 public: | 124 public: |
126 BrowserMainRunnerImpl() | 125 BrowserMainRunnerImpl() |
127 : initialization_started_(false), is_shutdown_(false) {} | 126 : initialization_started_(false), is_shutdown_(false) {} |
128 | 127 |
129 ~BrowserMainRunnerImpl() override { | 128 ~BrowserMainRunnerImpl() override { |
130 if (initialization_started_ && !is_shutdown_) | 129 if (initialization_started_ && !is_shutdown_) |
131 Shutdown(); | 130 Shutdown(); |
132 } | 131 } |
133 | 132 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 281 |
283 // True if the runner has been shut down. | 282 // True if the runner has been shut down. |
284 bool is_shutdown_; | 283 bool is_shutdown_; |
285 | 284 |
286 scoped_ptr<NotificationServiceImpl> notification_service_; | 285 scoped_ptr<NotificationServiceImpl> notification_service_; |
287 scoped_ptr<BrowserMainLoop> main_loop_; | 286 scoped_ptr<BrowserMainLoop> main_loop_; |
288 #if defined(OS_WIN) | 287 #if defined(OS_WIN) |
289 scoped_ptr<ui::ScopedOleInitializer> ole_initializer_; | 288 scoped_ptr<ui::ScopedOleInitializer> ole_initializer_; |
290 #endif | 289 #endif |
291 | 290 |
| 291 private: |
292 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); | 292 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); |
293 }; | 293 }; |
294 | 294 |
295 // static | 295 // static |
296 BrowserMainRunner* BrowserMainRunner::Create() { | 296 BrowserMainRunner* BrowserMainRunner::Create() { |
297 return new BrowserMainRunnerImpl(); | 297 return new BrowserMainRunnerImpl(); |
298 } | 298 } |
299 | 299 |
| 300 // static |
| 301 bool BrowserMainRunner::ExitedMainMessageLoop() { |
| 302 return g_exited_main_message_loop; |
| 303 } |
| 304 |
300 } // namespace content | 305 } // namespace content |
OLD | NEW |