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

Side by Side Diff: content/shell/shell_content_browser_client.cc

Issue 13409003: Hide ContentClient getters from embedders so that they they don't reuse content's embedder API. The… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 7 years, 8 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
OLDNEW
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/shell/shell_content_browser_client.h" 5 #include "content/shell/shell_content_browser_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "content/public/browser/render_process_host.h" 10 #include "content/public/browser/render_process_host.h"
(...skipping 19 matching lines...) Expand all
30 #include "base/android/path_utils.h" 30 #include "base/android/path_utils.h"
31 #include "base/path_service.h" 31 #include "base/path_service.h"
32 #include "base/platform_file.h" 32 #include "base/platform_file.h"
33 #include "content/shell/android/shell_descriptors.h" 33 #include "content/shell/android/shell_descriptors.h"
34 #endif 34 #endif
35 35
36 namespace content { 36 namespace content {
37 37
38 namespace { 38 namespace {
39 39
40 ShellContentBrowserClient* g_browser_client;
41
40 base::FilePath GetWebKitRootDirFilePath() { 42 base::FilePath GetWebKitRootDirFilePath() {
41 base::FilePath base_path; 43 base::FilePath base_path;
42 PathService::Get(base::DIR_SOURCE_ROOT, &base_path); 44 PathService::Get(base::DIR_SOURCE_ROOT, &base_path);
43 if (file_util::PathExists( 45 if (file_util::PathExists(
44 base_path.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { 46 base_path.Append(FILE_PATH_LITERAL("third_party/WebKit")))) {
45 // We're in a WebKit-in-chrome checkout. 47 // We're in a WebKit-in-chrome checkout.
46 return base_path.Append(FILE_PATH_LITERAL("third_party/WebKit")); 48 return base_path.Append(FILE_PATH_LITERAL("third_party/WebKit"));
47 } else if (file_util::PathExists( 49 } else if (file_util::PathExists(
48 base_path.Append(FILE_PATH_LITERAL("chromium")))) { 50 base_path.Append(FILE_PATH_LITERAL("chromium")))) {
49 // We're in a WebKit-only checkout on Windows. 51 // We're in a WebKit-only checkout on Windows.
(...skipping 15 matching lines...) Expand all
65 // We're in a WebKit-only checkout. 67 // We're in a WebKit-only checkout.
66 return webkit_path.Append(FILE_PATH_LITERAL("Source/WebKit/chromium")); 68 return webkit_path.Append(FILE_PATH_LITERAL("Source/WebKit/chromium"));
67 } else { 69 } else {
68 // We're in a Chromium checkout, and WebKit is in third_party/WebKit. 70 // We're in a Chromium checkout, and WebKit is in third_party/WebKit.
69 return webkit_path.Append(FILE_PATH_LITERAL("../..")); 71 return webkit_path.Append(FILE_PATH_LITERAL("../.."));
70 } 72 }
71 } 73 }
72 74
73 } // namespace 75 } // namespace
74 76
77 ShellContentBrowserClient* ShellContentBrowserClient::Get() {
78 return g_browser_client;
79 }
80
75 ShellContentBrowserClient::ShellContentBrowserClient() 81 ShellContentBrowserClient::ShellContentBrowserClient()
76 : hyphen_dictionary_file_(base::kInvalidPlatformFileValue), 82 : hyphen_dictionary_file_(base::kInvalidPlatformFileValue),
77 shell_browser_main_parts_(NULL) { 83 shell_browser_main_parts_(NULL) {
84 DCHECK(!g_browser_client);
85 g_browser_client = this;
78 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) 86 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
79 return; 87 return;
80 webkit_source_dir_ = GetWebKitRootDirFilePath(); 88 webkit_source_dir_ = GetWebKitRootDirFilePath();
81 base::FilePath dictionary_file_path = GetChromiumRootDirFilePath().Append( 89 base::FilePath dictionary_file_path = GetChromiumRootDirFilePath().Append(
82 FILE_PATH_LITERAL("third_party/hyphen/hyph_en_US.dic")); 90 FILE_PATH_LITERAL("third_party/hyphen/hyph_en_US.dic"));
83 file_util::AbsolutePath(&dictionary_file_path); 91 file_util::AbsolutePath(&dictionary_file_path);
84 hyphen_dictionary_file_ = base::CreatePlatformFile(dictionary_file_path, 92 hyphen_dictionary_file_ = base::CreatePlatformFile(dictionary_file_path,
85 base::PLATFORM_FILE_READ | 93 base::PLATFORM_FILE_READ |
86 base::PLATFORM_FILE_OPEN, 94 base::PLATFORM_FILE_OPEN,
87 NULL, 95 NULL,
88 NULL); 96 NULL);
89 } 97 }
90 98
91 ShellContentBrowserClient::~ShellContentBrowserClient() { 99 ShellContentBrowserClient::~ShellContentBrowserClient() {
100 g_browser_client = NULL;
92 } 101 }
93 102
94 BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( 103 BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts(
95 const MainFunctionParams& parameters) { 104 const MainFunctionParams& parameters) {
96 shell_browser_main_parts_ = new ShellBrowserMainParts(parameters); 105 shell_browser_main_parts_ = new ShellBrowserMainParts(parameters);
97 return shell_browser_main_parts_; 106 return shell_browser_main_parts_;
98 } 107 }
99 108
100 void ShellContentBrowserClient::RenderProcessHostCreated( 109 void ShellContentBrowserClient::RenderProcessHostCreated(
101 RenderProcessHost* host) { 110 RenderProcessHost* host) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 ShellBrowserContext* 231 ShellBrowserContext*
223 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( 232 ShellContentBrowserClient::ShellBrowserContextForBrowserContext(
224 BrowserContext* content_browser_context) { 233 BrowserContext* content_browser_context) {
225 if (content_browser_context == browser_context()) 234 if (content_browser_context == browser_context())
226 return browser_context(); 235 return browser_context();
227 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); 236 DCHECK_EQ(content_browser_context, off_the_record_browser_context());
228 return off_the_record_browser_context(); 237 return off_the_record_browser_context();
229 } 238 }
230 239
231 } // namespace content 240 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/shell_content_browser_client.h ('k') | content/shell/shell_content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698