- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / chromedriver / chrome / automation_extension.h
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_TEST_CHROMEDRIVER_CHROME_AUTOMATION_EXTENSION_H_
6 #define CHROME_TEST_CHROMEDRIVER_CHROME_AUTOMATION_EXTENSION_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12
13 namespace base {
14 class DictionaryValue;
15 }
16
17 class Status;
18 class WebView;
19
20 // Automates Chrome through the extension APIs.
21 class AutomationExtension {
22  public:
23   explicit AutomationExtension(scoped_ptr<WebView> web_view);
24   ~AutomationExtension();
25
26   // Captures the visible part of the current tab as a base64-encoded PNG.
27   // Returns |kForbidden| for security restricted pages.
28   Status CaptureScreenshot(std::string* screenshot);
29
30   // Gets the position of the current window.
31   Status GetWindowPosition(int* x, int* y);
32
33   // Sets the position of the current window.
34   Status SetWindowPosition(int x, int y);
35
36   // Gets the size of the current window.
37   Status GetWindowSize(int* width, int* height);
38
39   // Sets the size of the current window.
40   Status SetWindowSize(int width, int height);
41
42   // Maximizes the current window.
43   Status MaximizeWindow();
44
45  private:
46   Status GetWindowInfo(int* x, int* y, int* width, int* height);
47   Status UpdateWindow(const base::DictionaryValue& update_info);
48
49   scoped_ptr<WebView> web_view_;
50
51   DISALLOW_COPY_AND_ASSIGN(AutomationExtension);
52 };
53
54 #endif  // CHROME_TEST_CHROMEDRIVER_CHROME_AUTOMATION_EXTENSION_H_