| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2013 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_DOM_ACTIONS_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_DOM_ACTIONS_H_ | |
| 7 | |
| 8 #include "base/strings/string16.h" | |
| 9 #include "chrome/browser/extensions/activity_log/activity_actions.h" | |
| 10 #include "chrome/common/extensions/dom_action_types.h" | |
| 11 #include "url/gurl.h" | |
| 12 | |
| 13 namespace extensions { | |
| 14 | |
| 15 // This class describes extension actions that pertain to DOM API calls and | |
| 16 // content script insertions. | |
| 17 class DOMAction : public Action { | |
| 18 public: | |
| 19 // Create a new DOMAction to describe a new DOM API call. | |
| 20 // If the DOMAction is on a background page, the url & url_title may be null. | |
| 21 // If the DOMAction refers to a content script insertion, api_call may be null | |
| 22 // but args should be the name of the content script. | |
| 23 DOMAction(const std::string& extension_id, | |
| 24 const base::Time& time, | |
| 25 const DomActionType::Type verb, // what happened | |
| 26 const GURL& url, // the url of the page the | |
| 27 // script is running on | |
| 28 const string16& url_title, // the page title | |
| 29 const std::string& api_call, // the DOM API call | |
| 30 const std::string& args, // the args | |
| 31 const std::string& extra); // any extra logging info | |
| 32 | |
| 33 virtual scoped_ptr<api::activity_log_private::ExtensionActivity> | |
| 34 ConvertToExtensionActivity() OVERRIDE; | |
| 35 | |
| 36 // Record the action in the database. | |
| 37 virtual bool Record(sql::Connection* db) OVERRIDE; | |
| 38 | |
| 39 // Print a DOMAction as a regular string for debugging purposes. | |
| 40 virtual std::string PrintForDebug() OVERRIDE; | |
| 41 | |
| 42 // Helper methods for retrieving the values and debugging. | |
| 43 std::string VerbAsString() const; | |
| 44 const GURL& url() const { return url_; } | |
| 45 const string16& url_title() const { return url_title_; } | |
| 46 const std::string& api_call() const { return api_call_; } | |
| 47 const std::string& args() const { return args_; } | |
| 48 const std::string& extra() const { return extra_; } | |
| 49 | |
| 50 protected: | |
| 51 virtual ~DOMAction(); | |
| 52 | |
| 53 private: | |
| 54 DomActionType::Type verb_; | |
| 55 GURL url_; | |
| 56 string16 url_title_; | |
| 57 std::string api_call_; | |
| 58 std::string args_; | |
| 59 std::string extra_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(DOMAction); | |
| 62 }; | |
| 63 | |
| 64 } // namespace extensions | |
| 65 | |
| 66 #endif // CHROME_BROWSER_EXTENSIONS_ACTIVITY_LOG_DOM_ACTIONS_H_ | |
| 67 | |
| OLD | NEW |