• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_BROWSER_DEVTOOLS_DEVTOOLS_TOGGLE_ACTION_H_
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TOGGLE_ACTION_H_
7 
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string16.h"
11 
12 struct DevToolsToggleAction {
13  public:
14   enum Type {
15     kShow,
16     kShowConsole,
17     kInspect,
18     kToggle,
19     kReveal
20   };
21 
22   struct RevealParams {
23     RevealParams(const base::string16& url,
24                  size_t line_number,
25                  size_t column_number);
26     ~RevealParams();
27 
28     base::string16 url;
29     size_t line_number;
30     size_t column_number;
31   };
32 
33   void operator=(const DevToolsToggleAction& rhs);
34   DevToolsToggleAction(const DevToolsToggleAction& rhs);
35   ~DevToolsToggleAction();
36 
37   static DevToolsToggleAction Show();
38   static DevToolsToggleAction ShowConsole();
39   static DevToolsToggleAction Inspect();
40   static DevToolsToggleAction Toggle();
41   static DevToolsToggleAction Reveal(const base::string16& url,
42                                      size_t line_number,
43                                      size_t column_number);
44 
typeDevToolsToggleAction45   Type type() const { return type_; }
paramsDevToolsToggleAction46   const RevealParams* params() const { return params_.get(); }
47 
48  private:
49   explicit DevToolsToggleAction(Type type);
50   explicit DevToolsToggleAction(RevealParams* reveal_params);
51 
52   // The type of action.
53   Type type_;
54 
55   // Additional parameters for the Reveal action; NULL if of any other type.
56   scoped_ptr<RevealParams> params_;
57 };
58 
59 #endif  // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TOGGLE_ACTION_H_
60