Home | History | Annotate | Download | only in devtools
      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     kNoOp
     21   };
     22 
     23   struct RevealParams {
     24     RevealParams(const base::string16& url,
     25                  size_t line_number,
     26                  size_t column_number);
     27     ~RevealParams();
     28 
     29     base::string16 url;
     30     size_t line_number;
     31     size_t column_number;
     32   };
     33 
     34   void operator=(const DevToolsToggleAction& rhs);
     35   DevToolsToggleAction(const DevToolsToggleAction& rhs);
     36   ~DevToolsToggleAction();
     37 
     38   static DevToolsToggleAction Show();
     39   static DevToolsToggleAction ShowConsole();
     40   static DevToolsToggleAction Inspect();
     41   static DevToolsToggleAction Toggle();
     42   static DevToolsToggleAction Reveal(const base::string16& url,
     43                                      size_t line_number,
     44                                      size_t column_number);
     45   static DevToolsToggleAction NoOp();
     46 
     47   Type type() const { return type_; }
     48   const RevealParams* params() const { return params_.get(); }
     49 
     50  private:
     51   explicit DevToolsToggleAction(Type type);
     52   explicit DevToolsToggleAction(RevealParams* reveal_params);
     53 
     54   // The type of action.
     55   Type type_;
     56 
     57   // Additional parameters for the Reveal action; NULL if of any other type.
     58   scoped_ptr<RevealParams> params_;
     59 };
     60 
     61 #endif  // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_TOGGLE_ACTION_H_
     62