| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_TEST_AUTOMATION_EXTENSION_PROXY_H_ | |
| 6 #define CHROME_TEST_AUTOMATION_EXTENSION_PROXY_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "chrome/common/automation_constants.h" | |
| 13 #include "chrome/test/automation/automation_handle_tracker.h" | |
| 14 | |
| 15 class AutomationMessageSender; | |
| 16 class BrowserProxy; | |
| 17 | |
| 18 // This class presents the interface to actions that can be performed on | |
| 19 // a given extension. This refers to a particular version of that extension. | |
| 20 // For example, it refers to Google Translate 1.0. If the extension is | |
| 21 // updated to a newer version, this proxy is invalidated. | |
| 22 class ExtensionProxy : public AutomationResourceProxy { | |
| 23 public: | |
| 24 // Creates an extension proxy referring to an extension id. | |
| 25 ExtensionProxy(AutomationMessageSender* sender, | |
| 26 AutomationHandleTracker* tracker, | |
| 27 int handle); | |
| 28 | |
| 29 // Uninstalls this extension. Returns true on success. | |
| 30 bool Uninstall() WARN_UNUSED_RESULT; | |
| 31 | |
| 32 // Enables this extension. Returns true on success. The extension | |
| 33 // should be disabled when this is called. | |
| 34 bool Enable() WARN_UNUSED_RESULT; | |
| 35 | |
| 36 // Disables this extension. Returns true on success. The extension | |
| 37 // should be enabled when this is called. | |
| 38 bool Disable() WARN_UNUSED_RESULT; | |
| 39 | |
| 40 // Executes the action associated with this extension. This may be a page | |
| 41 // action or a browser action. This is similar to clicking, but does not | |
| 42 // work with popups. Also, for page actions, this will execute the action | |
| 43 // even if the page action is not shown for the active tab. Returns true on | |
| 44 // success. | |
| 45 // TODO(kkania): Add support for popups. | |
| 46 bool ExecuteActionInActiveTabAsync(BrowserProxy* browser) | |
| 47 WARN_UNUSED_RESULT; | |
| 48 | |
| 49 // Moves the browser action from its current location in the browser action | |
| 50 // toolbar to a new |index|. Index should be less than the number of browser | |
| 51 // actions in the toolbar. Returns true on success. | |
| 52 bool MoveBrowserAction(int index) WARN_UNUSED_RESULT; | |
| 53 | |
| 54 // Gets the id of this extension. Returns true on success. | |
| 55 bool GetId(std::string* id) WARN_UNUSED_RESULT; | |
| 56 | |
| 57 // Gets the name of this extension. Returns true on success. | |
| 58 bool GetName(std::string* name) WARN_UNUSED_RESULT; | |
| 59 | |
| 60 // Gets the version string of this extension. Returns true on success. | |
| 61 bool GetVersion(std::string* version) WARN_UNUSED_RESULT; | |
| 62 | |
| 63 // Gets the index (zero-based) of this extension's browser action in | |
| 64 // the browser action toolbar. |index| will be set to -1 if the extension | |
| 65 // does not have a browser action in the toolbar. Returns true on success. | |
| 66 bool GetBrowserActionIndex(int* index) WARN_UNUSED_RESULT; | |
| 67 | |
| 68 private: | |
| 69 // Gets the string value of the property of type |type|. Returns true on | |
| 70 // success. | |
| 71 bool GetProperty(AutomationMsg_ExtensionProperty type, std::string* value) | |
| 72 WARN_UNUSED_RESULT; | |
| 73 }; | |
| 74 | |
| 75 #endif // CHROME_TEST_AUTOMATION_EXTENSION_PROXY_H_ | |
| OLD | NEW |