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 #ifndef CHROME_BROWSER_CHROME_CONTENT_BROWSER_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_CHROME_CONTENT_BROWSER_CLIENT_H_ |
6 #define CHROME_BROWSER_CHROME_CONTENT_BROWSER_CLIENT_H_ | 6 #define CHROME_BROWSER_CHROME_CONTENT_BROWSER_CLIENT_H_ |
7 | 7 |
8 #include <deque> | |
8 #include <set> | 9 #include <set> |
9 #include <string> | 10 #include <string> |
10 #include <utility> | 11 #include <utility> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
17 #include "chrome/common/chrome_version_info.h" | 18 #include "chrome/common/chrome_version_info.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
43 ~ChromeContentBrowserClient() override; | 44 ~ChromeContentBrowserClient() override; |
44 | 45 |
45 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 46 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
46 | 47 |
47 // Notification that the application locale has changed. This allows us to | 48 // Notification that the application locale has changed. This allows us to |
48 // update our I/O thread cache of this value. | 49 // update our I/O thread cache of this value. |
49 static void SetApplicationLocale(const std::string& locale); | 50 static void SetApplicationLocale(const std::string& locale); |
50 | 51 |
51 content::BrowserMainParts* CreateBrowserMainParts( | 52 content::BrowserMainParts* CreateBrowserMainParts( |
52 const content::MainFunctionParams& parameters) override; | 53 const content::MainFunctionParams& parameters) override; |
54 void PostAfterStartupTask(const tracked_objects::Location& from_here, | |
55 const scoped_refptr<base::TaskRunner>& task_runner, | |
56 const base::Closure& task) override; | |
53 std::string GetStoragePartitionIdForSite( | 57 std::string GetStoragePartitionIdForSite( |
54 content::BrowserContext* browser_context, | 58 content::BrowserContext* browser_context, |
55 const GURL& site) override; | 59 const GURL& site) override; |
56 bool IsValidStoragePartitionId(content::BrowserContext* browser_context, | 60 bool IsValidStoragePartitionId(content::BrowserContext* browser_context, |
57 const std::string& partition_id) override; | 61 const std::string& partition_id) override; |
58 void GetStoragePartitionConfigForSite( | 62 void GetStoragePartitionConfigForSite( |
59 content::BrowserContext* browser_context, | 63 content::BrowserContext* browser_context, |
60 const GURL& site, | 64 const GURL& site, |
61 bool can_be_default, | 65 bool can_be_default, |
62 std::string* partition_domain, | 66 std::string* partition_domain, |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 content::RenderFrameHost* render_frame_host, | 263 content::RenderFrameHost* render_frame_host, |
260 blink::WebPageVisibilityState* visibility_state) override; | 264 blink::WebPageVisibilityState* visibility_state) override; |
261 | 265 |
262 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 266 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
263 void GetAdditionalMappedFilesForChildProcess( | 267 void GetAdditionalMappedFilesForChildProcess( |
264 const base::CommandLine& command_line, | 268 const base::CommandLine& command_line, |
265 int child_process_id, | 269 int child_process_id, |
266 content::FileDescriptorInfo* mappings) override; | 270 content::FileDescriptorInfo* mappings) override; |
267 #endif | 271 #endif |
268 #if defined(OS_WIN) | 272 #if defined(OS_WIN) |
269 virtual const wchar_t* GetResourceDllName() override; | 273 const wchar_t* GetResourceDllName() override; |
270 virtual void PreSpawnRenderer(sandbox::TargetPolicy* policy, | 274 void PreSpawnRenderer(sandbox::TargetPolicy* policy, bool* success) override; |
271 bool* success) override; | |
272 #endif | 275 #endif |
273 bool CheckMediaAccessPermission(content::BrowserContext* browser_context, | 276 bool CheckMediaAccessPermission(content::BrowserContext* browser_context, |
274 const GURL& security_origin, | 277 const GURL& security_origin, |
275 content::MediaStreamType type) override; | 278 content::MediaStreamType type) override; |
276 | 279 |
277 void OpenURL(content::BrowserContext* browser_context, | 280 void OpenURL(content::BrowserContext* browser_context, |
278 const content::OpenURLParams& params, | 281 const content::OpenURLParams& params, |
279 const base::Callback<void(content::WebContents*)>& callback) | 282 const base::Callback<void(content::WebContents*)>& callback) |
280 override; | 283 override; |
281 | 284 |
282 void RecordURLMetric(const std::string& metric, const GURL& url) override; | 285 void RecordURLMetric(const std::string& metric, const GURL& url) override; |
283 | 286 |
284 private: | 287 private: |
285 friend class DisableWebRtcEncryptionFlagTest; | 288 friend class DisableWebRtcEncryptionFlagTest; |
286 | 289 |
290 struct AfterStartupTask { | |
291 AfterStartupTask( | |
292 const tracked_objects::Location& from_here, | |
293 const scoped_refptr<base::TaskRunner>& task_runner, | |
294 const base::Closure& task) | |
295 : from_here(from_here), task_runner(task_runner), task(task) {} | |
296 | |
297 const tracked_objects::Location from_here; | |
298 const scoped_refptr<base::TaskRunner> task_runner; | |
299 const base::Closure task; | |
300 }; | |
301 | |
302 void QueueAfterStartupTask(scoped_ptr<AfterStartupTask> queued_task); | |
303 void OnAfterStartupTasksTimer(); | |
304 void ScheduleRunAfterStartupTask(scoped_ptr<AfterStartupTask> queued_task); | |
305 void RunAfterStartupTask(scoped_ptr<AfterStartupTask> queued_task); | |
306 | |
307 | |
jam
2015/03/26 15:38:58
nit: extra line
| |
287 #if defined(ENABLE_WEBRTC) | 308 #if defined(ENABLE_WEBRTC) |
288 // Copies disable WebRTC encryption switch depending on the channel. | 309 // Copies disable WebRTC encryption switch depending on the channel. |
289 static void MaybeCopyDisableWebRtcEncryptionSwitch( | 310 static void MaybeCopyDisableWebRtcEncryptionSwitch( |
290 base::CommandLine* to_command_line, | 311 base::CommandLine* to_command_line, |
291 const base::CommandLine& from_command_line, | 312 const base::CommandLine& from_command_line, |
292 VersionInfo::Channel channel); | 313 VersionInfo::Channel channel); |
293 #endif | 314 #endif |
294 | 315 |
295 void FileSystemAccessed( | 316 void FileSystemAccessed( |
296 const GURL& url, | 317 const GURL& url, |
(...skipping 24 matching lines...) Expand all Loading... | |
321 // Set of origins that can use "dev chanel" APIs from NaCl, even on stable | 342 // Set of origins that can use "dev chanel" APIs from NaCl, even on stable |
322 // versions of Chrome. | 343 // versions of Chrome. |
323 std::set<std::string> allowed_dev_channel_origins_; | 344 std::set<std::string> allowed_dev_channel_origins_; |
324 #endif | 345 #endif |
325 | 346 |
326 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 347 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
327 base::ScopedFD v8_natives_fd_; | 348 base::ScopedFD v8_natives_fd_; |
328 base::ScopedFD v8_snapshot_fd_; | 349 base::ScopedFD v8_snapshot_fd_; |
329 #endif // OS_POSIX && !OS_MACOSX | 350 #endif // OS_POSIX && !OS_MACOSX |
330 | 351 |
352 // Only accessed on the UI thread. | |
353 std::deque<AfterStartupTask*> after_startup_tasks_; | |
354 | |
331 // Vector of additional ChromeContentBrowserClientParts. | 355 // Vector of additional ChromeContentBrowserClientParts. |
332 // Parts are deleted in the reverse order they are added. | 356 // Parts are deleted in the reverse order they are added. |
333 std::vector<ChromeContentBrowserClientParts*> extra_parts_; | 357 std::vector<ChromeContentBrowserClientParts*> extra_parts_; |
334 | 358 |
359 base::WeakPtr<ChromeContentBrowserClient> weak_this_; | |
335 base::WeakPtrFactory<ChromeContentBrowserClient> weak_factory_; | 360 base::WeakPtrFactory<ChromeContentBrowserClient> weak_factory_; |
336 | 361 |
337 DISALLOW_COPY_AND_ASSIGN(ChromeContentBrowserClient); | 362 DISALLOW_COPY_AND_ASSIGN(ChromeContentBrowserClient); |
338 }; | 363 }; |
339 | 364 |
340 } // namespace chrome | 365 } // namespace chrome |
341 | 366 |
342 #endif // CHROME_BROWSER_CHROME_CONTENT_BROWSER_CLIENT_H_ | 367 #endif // CHROME_BROWSER_CHROME_CONTENT_BROWSER_CLIENT_H_ |
OLD | NEW |