Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: mojo/examples/window_manager/debug_panel.cc

Issue 460863002: Rename Node to View in the View Manager mojom & client lib. Service TBD. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/examples/window_manager/debug_panel.h" 5 #include "mojo/examples/window_manager/debug_panel.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "mojo/services/public/cpp/view_manager/node.h" 9 #include "mojo/services/public/cpp/view_manager/view.h"
10 #include "mojo/views/native_widget_view_manager.h" 10 #include "mojo/views/native_widget_view_manager.h"
11 #include "ui/gfx/text_constants.h" 11 #include "ui/gfx/text_constants.h"
12 #include "ui/views/background.h" 12 #include "ui/views/background.h"
13 #include "ui/views/controls/button/blue_button.h" 13 #include "ui/views/controls/button/blue_button.h"
14 #include "ui/views/controls/button/radio_button.h" 14 #include "ui/views/controls/button/radio_button.h"
15 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
16 16
17 namespace mojo { 17 namespace mojo {
18 namespace examples { 18 namespace examples {
19 19
20 namespace { 20 namespace {
21 21
22 const int kControlBorderInset = 5; 22 const int kControlBorderInset = 5;
23 const int kNavigationTargetGroupId = 1; 23 const int kNavigationTargetGroupId = 1;
24 24
25 } // namespace 25 } // namespace
26 26
27 DebugPanel::DebugPanel(Delegate* delegate, Node* node) 27 DebugPanel::DebugPanel(Delegate* delegate, View* view)
28 : delegate_(delegate), 28 : delegate_(delegate),
29 node_(node), 29 view_(view),
30 navigation_target_label_(new views::Label( 30 navigation_target_label_(new views::Label(
31 base::ASCIIToUTF16("Navigation target:"))), 31 base::ASCIIToUTF16("Navigation target:"))),
32 navigation_target_new_(new views::RadioButton( 32 navigation_target_new_(new views::RadioButton(
33 base::ASCIIToUTF16("New window"), kNavigationTargetGroupId)), 33 base::ASCIIToUTF16("New window"), kNavigationTargetGroupId)),
34 navigation_target_source_(new views::RadioButton( 34 navigation_target_source_(new views::RadioButton(
35 base::ASCIIToUTF16("Source window"), kNavigationTargetGroupId)), 35 base::ASCIIToUTF16("Source window"), kNavigationTargetGroupId)),
36 navigation_target_default_(new views::RadioButton( 36 navigation_target_default_(new views::RadioButton(
37 base::ASCIIToUTF16("Default"), kNavigationTargetGroupId)), 37 base::ASCIIToUTF16("Default"), kNavigationTargetGroupId)),
38 next_color_(0), 38 next_color_(0),
39 colored_square_(new views::BlueButton( 39 colored_square_(new views::BlueButton(
(...skipping 13 matching lines...) Expand all
53 widget_delegate->GetContentsView()->AddChildView(navigation_target_new_); 53 widget_delegate->GetContentsView()->AddChildView(navigation_target_new_);
54 widget_delegate->GetContentsView()->AddChildView(navigation_target_source_); 54 widget_delegate->GetContentsView()->AddChildView(navigation_target_source_);
55 widget_delegate->GetContentsView()->AddChildView(colored_square_); 55 widget_delegate->GetContentsView()->AddChildView(colored_square_);
56 widget_delegate->GetContentsView()->AddChildView(close_last_); 56 widget_delegate->GetContentsView()->AddChildView(close_last_);
57 widget_delegate->GetContentsView()->AddChildView(cross_app_); 57 widget_delegate->GetContentsView()->AddChildView(cross_app_);
58 widget_delegate->GetContentsView()->SetLayoutManager(this); 58 widget_delegate->GetContentsView()->SetLayoutManager(this);
59 59
60 views::Widget* widget = new views::Widget(); 60 views::Widget* widget = new views::Widget();
61 views::Widget::InitParams params( 61 views::Widget::InitParams params(
62 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 62 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
63 params.native_widget = new NativeWidgetViewManager(widget, node); 63 params.native_widget = new NativeWidgetViewManager(widget, view);
64 params.delegate = widget_delegate; 64 params.delegate = widget_delegate;
65 params.bounds = gfx::Rect(node->bounds().size()); 65 params.bounds = gfx::Rect(view->bounds().size());
66 widget->Init(params); 66 widget->Init(params);
67 widget->Show(); 67 widget->Show();
68 } 68 }
69 69
70 DebugPanel::~DebugPanel() { 70 DebugPanel::~DebugPanel() {
71 } 71 }
72 72
73 gfx::Size DebugPanel::GetPreferredSize(const views::View* view) const { 73 gfx::Size DebugPanel::GetPreferredSize(const views::View* view) const {
74 return gfx::Size(); 74 return gfx::Size();
75 } 75 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } else if (sender == close_last_) { 123 } else if (sender == close_last_) {
124 delegate_->CloseTopWindow(); 124 delegate_->CloseTopWindow();
125 } else if (sender == cross_app_) { 125 } else if (sender == cross_app_) {
126 Navigate("http://www.aaronboodman.com/z_dropbox/test.html"); 126 Navigate("http://www.aaronboodman.com/z_dropbox/test.html");
127 } 127 }
128 } 128 }
129 129
130 void DebugPanel::Navigate(const std::string& url) { 130 void DebugPanel::Navigate(const std::string& url) {
131 NavigationDetailsPtr details(NavigationDetails::New()); 131 NavigationDetailsPtr details(NavigationDetails::New());
132 details->request->url = url; 132 details->request->url = url;
133 delegate_->RequestNavigate(node_->id(), TARGET_NEW_NODE, details.Pass()); 133 delegate_->RequestNavigate(view_->id(), TARGET_NEW_NODE, details.Pass());
134 } 134 }
135 135
136 } // namespace examples 136 } // namespace examples
137 } // namespace mojo 137 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/examples/window_manager/debug_panel.h ('k') | mojo/examples/window_manager/window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698