| OLD | NEW |
| 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/api/declarative_content/content_action.h" | 5 #include "chrome/browser/extensions/api/declarative_content/content_action.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/extensions/api/declarative_content/content_constants.h" | 12 #include "chrome/browser/extensions/api/declarative_content/content_constants.h" |
| 13 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 13 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| 14 #include "chrome/browser/extensions/declarative_user_script_manager.h" |
| 14 #include "chrome/browser/extensions/extension_action.h" | 15 #include "chrome/browser/extensions/extension_action.h" |
| 15 #include "chrome/browser/extensions/extension_action_manager.h" | 16 #include "chrome/browser/extensions/extension_action_manager.h" |
| 16 #include "chrome/browser/extensions/extension_tab_util.h" | 17 #include "chrome/browser/extensions/extension_tab_util.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/sessions/session_tab_helper.h" | 19 #include "chrome/browser/sessions/session_tab_helper.h" |
| 19 #include "content/public/browser/invalidate_type.h" | 20 #include "content/public/browser/invalidate_type.h" |
| 20 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
| 21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 22 #include "extensions/browser/extension_registry.h" | 23 #include "extensions/browser/extension_registry.h" |
| 23 #include "extensions/browser/extension_system.h" | 24 #include "extensions/browser/extension_system.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 345 |
| 345 return true; | 346 return true; |
| 346 } | 347 } |
| 347 | 348 |
| 348 RequestContentScript::RequestContentScript( | 349 RequestContentScript::RequestContentScript( |
| 349 content::BrowserContext* browser_context, | 350 content::BrowserContext* browser_context, |
| 350 const Extension* extension, | 351 const Extension* extension, |
| 351 const ScriptData& script_data) { | 352 const ScriptData& script_data) { |
| 352 InitScript(extension, script_data); | 353 InitScript(extension, script_data); |
| 353 | 354 |
| 354 master_ = | 355 master_ = ExtensionSystem::Get(browser_context)-> |
| 355 ExtensionSystem::Get(browser_context)-> | 356 declarative_user_script_manager()-> |
| 356 GetDeclarativeUserScriptMasterByExtension(extension->id()); | 357 GetDeclarativeUserScriptMasterByID(extension->id()); |
| 357 AddScript(); | 358 AddScript(); |
| 358 } | 359 } |
| 359 | 360 |
| 360 RequestContentScript::RequestContentScript( | 361 RequestContentScript::RequestContentScript( |
| 361 DeclarativeUserScriptMaster* master, | 362 DeclarativeUserScriptMaster* master, |
| 362 const Extension* extension, | 363 const Extension* extension, |
| 363 const ScriptData& script_data) { | 364 const ScriptData& script_data) { |
| 364 InitScript(extension, script_data); | 365 InitScript(extension, script_data); |
| 365 | 366 |
| 366 master_ = master; | 367 master_ = master; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 bool* bad_message, | 496 bool* bad_message, |
| 496 const base::DictionaryValue** action_dict, | 497 const base::DictionaryValue** action_dict, |
| 497 std::string* instance_type) { | 498 std::string* instance_type) { |
| 498 INPUT_FORMAT_VALIDATE(json_action.GetAsDictionary(action_dict)); | 499 INPUT_FORMAT_VALIDATE(json_action.GetAsDictionary(action_dict)); |
| 499 INPUT_FORMAT_VALIDATE( | 500 INPUT_FORMAT_VALIDATE( |
| 500 (*action_dict)->GetString(keys::kInstanceType, instance_type)); | 501 (*action_dict)->GetString(keys::kInstanceType, instance_type)); |
| 501 return true; | 502 return true; |
| 502 } | 503 } |
| 503 | 504 |
| 504 } // namespace extensions | 505 } // namespace extensions |
| OLD | NEW |