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

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

Issue 7229012: Use extension match pattern syntax in content settings extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initialize port Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/user_script_master.h" 5 #include "chrome/browser/extensions/user_script_master.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 script->set_name(value); 100 script->set_name(value);
101 } else if (GetDeclarationValue(line, kVersionDeclaration, &value)) { 101 } else if (GetDeclarationValue(line, kVersionDeclaration, &value)) {
102 scoped_ptr<Version> version(Version::GetVersionFromString(value)); 102 scoped_ptr<Version> version(Version::GetVersionFromString(value));
103 if (version.get()) 103 if (version.get())
104 script->set_version(version->GetString()); 104 script->set_version(version->GetString());
105 } else if (GetDeclarationValue(line, kDescriptionDeclaration, &value)) { 105 } else if (GetDeclarationValue(line, kDescriptionDeclaration, &value)) {
106 script->set_description(value); 106 script->set_description(value);
107 } else if (GetDeclarationValue(line, kMatchDeclaration, &value)) { 107 } else if (GetDeclarationValue(line, kMatchDeclaration, &value)) {
108 URLPattern pattern(UserScript::kValidUserScriptSchemes); 108 URLPattern pattern(UserScript::kValidUserScriptSchemes);
109 if (URLPattern::PARSE_SUCCESS != 109 if (URLPattern::PARSE_SUCCESS !=
110 pattern.Parse(value, URLPattern::PARSE_LENIENT)) 110 pattern.Parse(value, URLPattern::IGNORE_PORTS))
111 return false; 111 return false;
112 script->add_url_pattern(pattern); 112 script->add_url_pattern(pattern);
113 } else if (GetDeclarationValue(line, kRunAtDeclaration, &value)) { 113 } else if (GetDeclarationValue(line, kRunAtDeclaration, &value)) {
114 if (value == kRunAtDocumentStartValue) 114 if (value == kRunAtDocumentStartValue)
115 script->set_run_location(UserScript::DOCUMENT_START); 115 script->set_run_location(UserScript::DOCUMENT_START);
116 else if (value == kRunAtDocumentEndValue) 116 else if (value == kRunAtDocumentEndValue)
117 script->set_run_location(UserScript::DOCUMENT_END); 117 script->set_run_location(UserScript::DOCUMENT_END);
118 else if (value == kRunAtDocumentIdleValue) 118 else if (value == kRunAtDocumentIdleValue)
119 script->set_run_location(UserScript::DOCUMENT_IDLE); 119 script->set_run_location(UserScript::DOCUMENT_IDLE);
120 else 120 else
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if (!handle) 372 if (!handle)
373 return; 373 return;
374 374
375 base::SharedMemoryHandle handle_for_process; 375 base::SharedMemoryHandle handle_for_process;
376 if (!shared_memory->ShareToProcess(handle, &handle_for_process)) 376 if (!shared_memory->ShareToProcess(handle, &handle_for_process))
377 return; // This can legitimately fail if the renderer asserts at startup. 377 return; // This can legitimately fail if the renderer asserts at startup.
378 378
379 if (base::SharedMemory::IsHandleValid(handle_for_process)) 379 if (base::SharedMemory::IsHandleValid(handle_for_process))
380 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process)); 380 process->Send(new ExtensionMsg_UpdateUserScripts(handle_for_process));
381 } 381 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698