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/extension_action.h" | 14 #include "chrome/browser/extensions/extension_action.h" |
15 #include "chrome/browser/extensions/extension_action_manager.h" | 15 #include "chrome/browser/extensions/extension_action_manager.h" |
16 #include "chrome/browser/extensions/extension_tab_util.h" | 16 #include "chrome/browser/extensions/extension_tab_util.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/sessions/session_tab_helper.h" | |
19 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" | |
18 #include "content/public/browser/invalidate_type.h" | 20 #include "content/public/browser/invalidate_type.h" |
21 #include "content/public/browser/render_process_host.h" | |
Devlin
2014/08/25 22:31:05
still need this?
Mark Dittmer
2014/08/26 17:53:58
Nope. Removed.
| |
22 #include "content/public/browser/render_view_host.h" | |
19 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
20 #include "extensions/browser/extension_registry.h" | 24 #include "extensions/browser/extension_registry.h" |
21 #include "extensions/browser/extension_system.h" | 25 #include "extensions/browser/extension_system.h" |
22 #include "extensions/common/extension.h" | 26 #include "extensions/common/extension.h" |
27 #include "extensions/common/extension_messages.h" | |
23 | 28 |
24 namespace extensions { | 29 namespace extensions { |
25 | 30 |
26 namespace keys = declarative_content_constants; | 31 namespace keys = declarative_content_constants; |
27 | 32 |
28 namespace { | 33 namespace { |
29 // Error messages. | 34 // Error messages. |
30 const char kInvalidInstanceTypeError[] = | 35 const char kInvalidInstanceTypeError[] = |
31 "An action has an invalid instanceType: %s"; | 36 "An action has an invalid instanceType: %s"; |
32 const char kNoPageAction[] = | 37 const char kNoPageAction[] = |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 InstructRenderProcessToInject(apply_info->tab, extension_id); | 316 InstructRenderProcessToInject(apply_info->tab, extension_id); |
312 } | 317 } |
313 | 318 |
314 void RequestContentScript::Revert(const std::string& extension_id, | 319 void RequestContentScript::Revert(const std::string& extension_id, |
315 const base::Time& extension_install_time, | 320 const base::Time& extension_install_time, |
316 ApplyInfo* apply_info) const {} | 321 ApplyInfo* apply_info) const {} |
317 | 322 |
318 void RequestContentScript::InstructRenderProcessToInject( | 323 void RequestContentScript::InstructRenderProcessToInject( |
319 content::WebContents* contents, | 324 content::WebContents* contents, |
320 const std::string& extension_id) const { | 325 const std::string& extension_id) const { |
321 // TODO(markdittmer): Send ExtensionMsg to renderer. | 326 content::RenderViewHost* render_view_host = contents->GetRenderViewHost(); |
327 render_view_host->Send(new ExtensionMsg_ExecuteDeclarativeScript( | |
328 render_view_host->GetRoutingID(), | |
329 SessionTabHelper::IdForTab(contents), | |
330 extension_id, | |
331 script_.id(), | |
332 contents->GetLastCommittedURL())); | |
322 } | 333 } |
323 | 334 |
324 // | 335 // |
325 // ContentAction | 336 // ContentAction |
326 // | 337 // |
327 | 338 |
328 ContentAction::ContentAction() {} | 339 ContentAction::ContentAction() {} |
329 | 340 |
330 ContentAction::~ContentAction() {} | 341 ContentAction::~ContentAction() {} |
331 | 342 |
(...skipping 26 matching lines...) Expand all Loading... | |
358 bool* bad_message, | 369 bool* bad_message, |
359 const base::DictionaryValue** action_dict, | 370 const base::DictionaryValue** action_dict, |
360 std::string* instance_type) { | 371 std::string* instance_type) { |
361 INPUT_FORMAT_VALIDATE(json_action.GetAsDictionary(action_dict)); | 372 INPUT_FORMAT_VALIDATE(json_action.GetAsDictionary(action_dict)); |
362 INPUT_FORMAT_VALIDATE( | 373 INPUT_FORMAT_VALIDATE( |
363 (*action_dict)->GetString(keys::kInstanceType, instance_type)); | 374 (*action_dict)->GetString(keys::kInstanceType, instance_type)); |
364 return true; | 375 return true; |
365 } | 376 } |
366 | 377 |
367 } // namespace extensions | 378 } // namespace extensions |
OLD | NEW |