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

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

Issue 10693157: Add pak file support for content shell and android apks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 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 | « content/shell/shell_content_browser_client.h ('k') | content/shell/shell_main_delegate.cc » ('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 (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_path.h" 8 #include "base/file_path.h"
9 #include "content/public/browser/resource_dispatcher_host.h" 9 #include "content/public/browser/resource_dispatcher_host.h"
10 #include "content/shell/geolocation/shell_access_token_store.h" 10 #include "content/shell/geolocation/shell_access_token_store.h"
11 #include "content/shell/layout_test_controller_host.h" 11 #include "content/shell/layout_test_controller_host.h"
12 #include "content/shell/shell.h" 12 #include "content/shell/shell.h"
13 #include "content/shell/shell_browser_context.h" 13 #include "content/shell/shell_browser_context.h"
14 #include "content/shell/shell_browser_main_parts.h" 14 #include "content/shell/shell_browser_main_parts.h"
15 #include "content/shell/shell_devtools_delegate.h" 15 #include "content/shell/shell_devtools_delegate.h"
16 #include "content/shell/shell_resource_dispatcher_host_delegate.h" 16 #include "content/shell/shell_resource_dispatcher_host_delegate.h"
17 #include "content/shell/shell_switches.h" 17 #include "content/shell/shell_switches.h"
18 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
19 19
20 #if defined(OS_ANDROID)
21 #include "base/android/path_utils.h"
22 #include "base/path_service.h"
23 #include "base/platform_file.h"
24 #include "content/shell/android/shell_descriptors.h"
25 #endif
26
20 namespace content { 27 namespace content {
21 28
22 ShellContentBrowserClient::ShellContentBrowserClient() 29 ShellContentBrowserClient::ShellContentBrowserClient()
23 : shell_browser_main_parts_(NULL) { 30 : shell_browser_main_parts_(NULL) {
24 } 31 }
25 32
26 ShellContentBrowserClient::~ShellContentBrowserClient() { 33 ShellContentBrowserClient::~ShellContentBrowserClient() {
27 } 34 }
28 35
29 BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( 36 BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts(
(...skipping 19 matching lines...) Expand all
49 resource_dispatcher_host_delegate_.reset( 56 resource_dispatcher_host_delegate_.reset(
50 new ShellResourceDispatcherHostDelegate()); 57 new ShellResourceDispatcherHostDelegate());
51 ResourceDispatcherHost::Get()->SetDelegate( 58 ResourceDispatcherHost::Get()->SetDelegate(
52 resource_dispatcher_host_delegate_.get()); 59 resource_dispatcher_host_delegate_.get());
53 } 60 }
54 61
55 std::string ShellContentBrowserClient::GetDefaultDownloadName() { 62 std::string ShellContentBrowserClient::GetDefaultDownloadName() {
56 return "download"; 63 return "download";
57 } 64 }
58 65
66 #if defined(OS_ANDROID)
67 void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
68 const CommandLine& command_line,
69 base::GlobalDescriptors::Mapping* mappings) {
70 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ;
71 FilePath pak_file;
72 DCHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_file));
73 pak_file = pak_file.Append(FILE_PATH_LITERAL("paks"));
74 pak_file = pak_file.Append(FILE_PATH_LITERAL("content_shell.pak"));
75
76 base::PlatformFile f =
77 base::CreatePlatformFile(pak_file, flags, NULL, NULL);
78 if (f == base::kInvalidPlatformFileValue) {
79 NOTREACHED() << "Failed to open file when creating renderer process: "
80 << "content_shell.pak";
81 }
82 mappings->push_back(std::pair<base::GlobalDescriptors::Key, int>(
83 kShellPakDescriptor, f));
84 }
85 #endif
86
59 ShellBrowserContext* ShellContentBrowserClient::browser_context() { 87 ShellBrowserContext* ShellContentBrowserClient::browser_context() {
60 return shell_browser_main_parts_->browser_context(); 88 return shell_browser_main_parts_->browser_context();
61 } 89 }
62 90
63 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { 91 AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() {
64 return new ShellAccessTokenStore(browser_context()->GetRequestContext()); 92 return new ShellAccessTokenStore(browser_context()->GetRequestContext());
65 } 93 }
66 94
67 } // namespace content 95 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/shell_content_browser_client.h ('k') | content/shell/shell_main_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698