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

Side by Side Diff: chrome/renderer/user_script_slave.cc

Issue 2855009: Only allow installation of extensions/apps with gallery update url via download from gallery (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: name change Created 10 years, 6 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/renderer/user_script_slave.h" 5 #include "chrome/renderer/user_script_slave.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/histogram.h" 9 #include "base/histogram.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/perftimer.h" 11 #include "base/perftimer.h"
12 #include "base/pickle.h" 12 #include "base/pickle.h"
13 #include "base/shared_memory.h" 13 #include "base/shared_memory.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/extensions/extension.h" 16 #include "chrome/common/extensions/extension.h"
17 #include "chrome/common/extensions/extension_constants.h"
18 #include "chrome/renderer/extension_groups.h" 17 #include "chrome/renderer/extension_groups.h"
19 #include "chrome/renderer/render_thread.h" 18 #include "chrome/renderer/render_thread.h"
20 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
21 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" 20 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
22 21
23 #include "grit/renderer_resources.h" 22 #include "grit/renderer_resources.h"
24 23
25 using WebKit::WebFrame; 24 using WebKit::WebFrame;
26 using WebKit::WebString; 25 using WebKit::WebString;
27 26
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 143
145 bool UserScriptSlave::InjectScripts(WebFrame* frame, 144 bool UserScriptSlave::InjectScripts(WebFrame* frame,
146 UserScript::RunLocation location) { 145 UserScript::RunLocation location) {
147 GURL frame_url = GURL(frame->url()); 146 GURL frame_url = GURL(frame->url());
148 // Don't bother if this is not a URL we inject script into. 147 // Don't bother if this is not a URL we inject script into.
149 if (!URLPattern::IsValidScheme(frame_url.scheme())) 148 if (!URLPattern::IsValidScheme(frame_url.scheme()))
150 return true; 149 return true;
151 150
152 // Don't inject user scripts into the gallery itself. This prevents 151 // Don't inject user scripts into the gallery itself. This prevents
153 // a user script from removing the "report abuse" link, for example. 152 // a user script from removing the "report abuse" link, for example.
154 if (frame_url.host() == GURL(extension_urls::kGalleryBrowsePrefix).host()) 153 if (frame_url.host() == GURL(Extension::ChromeStoreURL()).host())
155 return true; 154 return true;
156 155
157 PerfTimer timer; 156 PerfTimer timer;
158 int num_css = 0; 157 int num_css = 0;
159 int num_scripts = 0; 158 int num_scripts = 0;
160 159
161 for (size_t i = 0; i < scripts_.size(); ++i) { 160 for (size_t i = 0; i < scripts_.size(); ++i) {
162 std::vector<WebScriptSource> sources; 161 std::vector<WebScriptSource> sources;
163 UserScript* script = scripts_[i]; 162 UserScript* script = scripts_[i];
164 163
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 if (num_scripts) 235 if (num_scripts)
237 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed()); 236 UMA_HISTOGRAM_TIMES("Extensions.InjectIdle_Time", timer.Elapsed());
238 } else { 237 } else {
239 NOTREACHED(); 238 NOTREACHED();
240 } 239 }
241 240
242 LOG(INFO) << "Injected " << num_scripts << " scripts and " << num_css << 241 LOG(INFO) << "Injected " << num_scripts << " scripts and " << num_css <<
243 " css files into " << frame->url().spec().data(); 242 " css files into " << frame->url().spec().data();
244 return true; 243 return true;
245 } 244 }
OLDNEW
« chrome/browser/extensions/crx_installer.cc ('K') | « chrome/renderer/render_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698