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

Side by Side Diff: chrome/browser/extensions/extension_protocols.cc

Issue 12253022: Manifest handler for all keys background-related. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 "chrome/browser/extensions/extension_protocols.h" 5 #include "chrome/browser/extensions/extension_protocols.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
17 #include "base/threading/thread_restrictions.h" 17 #include "base/threading/thread_restrictions.h"
18 #include "base/threading/worker_pool.h" 18 #include "base/threading/worker_pool.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "chrome/browser/extensions/extension_info_map.h" 20 #include "chrome/browser/extensions/extension_info_map.h"
21 #include "chrome/browser/extensions/image_loader.h" 21 #include "chrome/browser/extensions/image_loader.h"
22 #include "chrome/browser/net/chrome_url_request_context.h" 22 #include "chrome/browser/net/chrome_url_request_context.h"
23 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
24 #include "chrome/common/extensions/api/icons/icons_handler.h" 24 #include "chrome/common/extensions/api/icons/icons_handler.h"
25 #include "chrome/common/extensions/background_info.h"
25 #include "chrome/common/extensions/extension.h" 26 #include "chrome/common/extensions/extension.h"
26 #include "chrome/common/extensions/extension_file_util.h" 27 #include "chrome/common/extensions/extension_file_util.h"
27 #include "chrome/common/extensions/extension_resource.h" 28 #include "chrome/common/extensions/extension_resource.h"
28 #include "chrome/common/extensions/manifest_url_handler.h" 29 #include "chrome/common/extensions/manifest_url_handler.h"
29 #include "chrome/common/extensions/web_accessible_resources_handler.h" 30 #include "chrome/common/extensions/web_accessible_resources_handler.h"
30 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
31 #include "content/public/browser/resource_request_info.h" 32 #include "content/public/browser/resource_request_info.h"
32 #include "extensions/common/constants.h" 33 #include "extensions/common/constants.h"
33 #include "googleurl/src/url_util.h" 34 #include "googleurl/src/url_util.h"
34 #include "grit/component_extension_resources_map.h" 35 #include "grit/component_extension_resources_map.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 164
164 // Overridden from URLRequestSimpleJob: 165 // Overridden from URLRequestSimpleJob:
165 virtual int GetData(std::string* mime_type, 166 virtual int GetData(std::string* mime_type,
166 std::string* charset, 167 std::string* charset,
167 std::string* data, 168 std::string* data,
168 const net::CompletionCallback& callback) const OVERRIDE { 169 const net::CompletionCallback& callback) const OVERRIDE {
169 *mime_type = "text/html"; 170 *mime_type = "text/html";
170 *charset = "utf-8"; 171 *charset = "utf-8";
171 172
172 *data = "<!DOCTYPE html>\n<body>\n"; 173 *data = "<!DOCTYPE html>\n<body>\n";
173 for (size_t i = 0; i < extension_->background_scripts().size(); ++i) { 174 const std::vector<std::string>& background_scripts =
175 extensions::BackgroundInfo::GetBackgroundScripts(extension_);
176 for (size_t i = 0; i < background_scripts.size(); ++i) {
174 *data += "<script src=\""; 177 *data += "<script src=\"";
175 *data += extension_->background_scripts()[i]; 178 *data += background_scripts[i];
176 *data += "\"></script>\n"; 179 *data += "\"></script>\n";
177 } 180 }
178 181
179 return net::OK; 182 return net::OK;
180 } 183 }
181 184
182 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE { 185 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE {
183 *info = response_info_; 186 *info = response_info_;
184 } 187 }
185 188
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 send_cors_header); 461 send_cors_header);
459 } 462 }
460 463
461 } // namespace 464 } // namespace
462 465
463 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler( 466 net::URLRequestJobFactory::ProtocolHandler* CreateExtensionProtocolHandler(
464 bool is_incognito, 467 bool is_incognito,
465 ExtensionInfoMap* extension_info_map) { 468 ExtensionInfoMap* extension_info_map) {
466 return new ExtensionProtocolHandler(is_incognito, extension_info_map); 469 return new ExtensionProtocolHandler(is_incognito, extension_info_map);
467 } 470 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_process_manager.cc ('k') | chrome/browser/extensions/extension_protocols_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698