debug_panel.h revision 1320f92c476a1ad9d19dba2a48c72b75566198e9
1// Copyright 2014 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 MOJO_EXAMPLES_WINDOW_MANAGER_DEBUG_PANEL_H_
6#define MOJO_EXAMPLES_WINDOW_MANAGER_DEBUG_PANEL_H_
7
8#include <string>
9
10#include "mojo/services/public/interfaces/navigation/navigation.mojom.h"
11#include "ui/views/controls/button/button.h"
12#include "ui/views/layout/layout_manager.h"
13#include "ui/views/widget/widget_delegate.h"
14
15namespace views {
16class Label;
17class RadioButton;
18}
19
20namespace mojo {
21
22class View;
23
24namespace examples {
25
26namespace {
27}
28
29// A panel of controls intended to demonstrate the functionality of the window
30// manager.
31class DebugPanel : public views::LayoutManager, public views::ButtonListener {
32 public:
33  class Delegate {
34   public:
35    virtual void CloseTopWindow() = 0;
36    virtual void RequestNavigate(uint32 source_view_id,
37                                 Target target,
38                                 URLRequestPtr url_request) = 0;
39
40   protected:
41    virtual ~Delegate(){}
42  };
43
44  DebugPanel(Delegate* delegate, View* view);
45  virtual ~DebugPanel();
46
47  Target navigation_target() const;
48
49 private:
50  // LayoutManager overrides:
51  virtual gfx::Size GetPreferredSize(const views::View* view) const OVERRIDE;
52  virtual void Layout(views::View* host) OVERRIDE;
53  virtual void ButtonPressed(views::Button* sender,
54                             const ui::Event& event) OVERRIDE;
55
56  void Navigate(const std::string& url);
57
58  Delegate* delegate_;
59  View* view_;
60
61  views::Label* navigation_target_label_;
62  views::RadioButton* navigation_target_new_;
63  views::RadioButton* navigation_target_source_;
64  views::RadioButton* navigation_target_default_;
65
66  views::Button* colored_square_;
67  views::Button* close_last_;
68  views::Button* cross_app_;
69
70  DISALLOW_COPY_AND_ASSIGN(DebugPanel);
71};
72
73}  // examples
74}  // mojo
75
76#endif  //  MOJO_EXAMPLES_WINDOW_MANAGER_DEBUG_PANEL_H_
77