Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / browser / extensions / api / declarative_content / content_action.h
blob404719feda75e1dce8687e492b06564aacd20095
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_ACTION_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_ACTION_H_
8 #include <string>
9 #include <vector>
11 #include "base/memory/ref_counted.h"
12 #include "chrome/browser/extensions/api/declarative/declarative_rule.h"
14 class Profile;
16 namespace base {
17 class Time;
18 class Value;
21 namespace content {
22 class WebContents;
25 namespace extensions {
26 class Extension;
28 // Base class for all ContentActions of the declarative content API.
29 class ContentAction : public base::RefCounted<ContentAction> {
30 public:
31 // Type identifiers for concrete ContentActions.
32 enum Type {
33 ACTION_SHOW_PAGE_ACTION,
36 struct ApplyInfo {
37 Profile* profile;
38 content::WebContents* tab;
41 ContentAction();
43 virtual Type GetType() const = 0;
45 // Applies or reverts this ContentAction on a particular tab for a particular
46 // extension. Revert exists to keep the actions up to date as the page
47 // changes.
48 virtual void Apply(const std::string& extension_id,
49 const base::Time& extension_install_time,
50 ApplyInfo* apply_info) const = 0;
51 virtual void Revert(const std::string& extension_id,
52 const base::Time& extension_install_time,
53 ApplyInfo* apply_info) const = 0;
55 // Factory method that instantiates a concrete ContentAction
56 // implementation according to |json_action|, the representation of the
57 // ContentAction as received from the extension API.
58 // Sets |error| and returns NULL in case of a semantic error that cannot
59 // be caught by schema validation. Sets |bad_message| and returns NULL
60 // in case the input is syntactically unexpected.
61 static scoped_refptr<ContentAction> Create(const Extension* extension,
62 const base::Value& json_action,
63 std::string* error,
64 bool* bad_message);
66 protected:
67 friend class base::RefCounted<ContentAction>;
68 virtual ~ContentAction();
71 typedef DeclarativeActionSet<ContentAction> ContentActionSet;
73 } // namespace extensions
75 #endif // CHROME_BROWSER_EXTENSIONS_API_DECLARATIVE_CONTENT_CONTENT_ACTION_H_