| OLD | NEW |
| 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/node.h" |
| 10 #include "mojo/views/native_widget_view_manager.h" | 10 #include "mojo/views/native_widget_view_manager.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| 76 | 76 |
| 77 navigation::Target DebugPanel::navigation_target() const { | 77 Target DebugPanel::navigation_target() const { |
| 78 if (navigation_target_new_->checked()) | 78 if (navigation_target_new_->checked()) |
| 79 return navigation::TARGET_NEW_NODE; | 79 return TARGET_NEW_NODE; |
| 80 if (navigation_target_source_->checked()) | 80 if (navigation_target_source_->checked()) |
| 81 return navigation::TARGET_SOURCE_NODE; | 81 return TARGET_SOURCE_NODE; |
| 82 return navigation::TARGET_DEFAULT; | 82 return TARGET_DEFAULT; |
| 83 } | 83 } |
| 84 | 84 |
| 85 void DebugPanel::Layout(views::View* view) { | 85 void DebugPanel::Layout(views::View* view) { |
| 86 int y = kControlBorderInset; | 86 int y = kControlBorderInset; |
| 87 int w = view->width() - kControlBorderInset * 2; | 87 int w = view->width() - kControlBorderInset * 2; |
| 88 | 88 |
| 89 navigation_target_label_->SetBounds( | 89 navigation_target_label_->SetBounds( |
| 90 kControlBorderInset, y, w, | 90 kControlBorderInset, y, w, |
| 91 navigation_target_label_->GetPreferredSize().height()); | 91 navigation_target_label_->GetPreferredSize().height()); |
| 92 y += navigation_target_label_->height(); | 92 y += navigation_target_label_->height(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 121 kColors[next_color_ % arraysize(kColors)])); | 121 kColors[next_color_ % arraysize(kColors)])); |
| 122 next_color_++; | 122 next_color_++; |
| 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 navigation::NavigationDetailsPtr details( | 131 NavigationDetailsPtr details(NavigationDetails::New()); |
| 132 navigation::NavigationDetails::New()); | |
| 133 details->url = url; | 132 details->url = url; |
| 134 delegate_->RequestNavigate( | 133 delegate_->RequestNavigate(node_->id(), TARGET_NEW_NODE, details.Pass()); |
| 135 node_->id(), navigation::TARGET_NEW_NODE, details.Pass()); | |
| 136 } | 134 } |
| 137 | 135 |
| 138 } // namespace examples | 136 } // namespace examples |
| 139 } // namespace mojo | 137 } // namespace mojo |
| OLD | NEW |