OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mash/webtest/webtest.h" | 5 #include "mash/webtest/webtest.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
14 #include "components/mus/public/cpp/window.h" | 14 #include "components/mus/public/cpp/window.h" |
15 #include "components/mus/public/cpp/window_tree_connection.h" | 15 #include "components/mus/public/cpp/window_tree_connection.h" |
16 #include "mash/public/interfaces/launchable.mojom.h" | 16 #include "mash/public/interfaces/launchable.mojom.h" |
17 #include "mojo/public/c/system/main.h" | 17 #include "mojo/public/c/system/main.h" |
18 #include "services/navigation/public/interfaces/view.mojom.h" | 18 #include "services/navigation/public/interfaces/view.mojom.h" |
19 #include "services/shell/public/cpp/application_runner.h" | 19 #include "services/shell/public/cpp/application_runner.h" |
20 #include "services/shell/public/cpp/connector.h" | 20 #include "services/shell/public/cpp/connector.h" |
21 #include "services/shell/public/cpp/shell_client.h" | 21 #include "services/shell/public/cpp/shell_client.h" |
22 #include "services/tracing/public/cpp/tracing_impl.h" | 22 #include "services/tracing/public/cpp/tracing_impl.h" |
23 #include "ui/aura/mus/mus_util.h" | 23 #include "ui/aura/mus/mus_util.h" |
24 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
25 #include "ui/gfx/geometry/mojo/geometry_type_converters.h" | |
26 #include "ui/gfx/paint_throbber.h" | 25 #include "ui/gfx/paint_throbber.h" |
27 #include "ui/native_theme/native_theme.h" | 26 #include "ui/native_theme/native_theme.h" |
28 #include "ui/views/background.h" | 27 #include "ui/views/background.h" |
29 #include "ui/views/controls/button/label_button.h" | 28 #include "ui/views/controls/button/label_button.h" |
30 #include "ui/views/controls/textfield/textfield.h" | 29 #include "ui/views/controls/textfield/textfield.h" |
31 #include "ui/views/controls/textfield/textfield_controller.h" | 30 #include "ui/views/controls/textfield/textfield_controller.h" |
32 #include "ui/views/mus/aura_init.h" | 31 #include "ui/views/mus/aura_init.h" |
33 #include "ui/views/mus/window_manager_connection.h" | 32 #include "ui/views/mus/window_manager_connection.h" |
34 #include "ui/views/widget/widget_delegate.h" | 33 #include "ui/views/widget/widget_delegate.h" |
35 #include "url/gurl.h" | 34 #include "url/gurl.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const mojo::String& title, | 104 const mojo::String& title, |
106 bool can_go_back, | 105 bool can_go_back, |
107 bool can_go_forward) override { | 106 bool can_go_forward) override { |
108 current_title_ = base::UTF8ToUTF16(title.get()); | 107 current_title_ = base::UTF8ToUTF16(title.get()); |
109 GetWidget()->UpdateWindowTitle(); | 108 GetWidget()->UpdateWindowTitle(); |
110 } | 109 } |
111 void LoadProgressChanged(double progress) override {} | 110 void LoadProgressChanged(double progress) override {} |
112 void ViewCreated(navigation::mojom::ViewPtr view, | 111 void ViewCreated(navigation::mojom::ViewPtr view, |
113 navigation::mojom::ViewClientRequest request, | 112 navigation::mojom::ViewClientRequest request, |
114 bool is_popup, | 113 bool is_popup, |
115 mojo::RectPtr initial_rect, | 114 const gfx::Rect& initial_rect, |
116 bool user_gesture) override { | 115 bool user_gesture) override { |
117 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( | 116 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( |
118 new UI(webtest_, std::move(view), std::move(request)), nullptr, | 117 new UI(webtest_, std::move(view), std::move(request)), nullptr, |
119 initial_rect.To<gfx::Rect>()); | 118 initial_rect); |
120 window->Show(); | 119 window->Show(); |
121 webtest_->AddWindow(window); | 120 webtest_->AddWindow(window); |
122 } | 121 } |
123 void Close() override { | 122 void Close() override { |
124 GetWidget()->Close(); | 123 GetWidget()->Close(); |
125 } | 124 } |
126 | 125 |
127 Webtest* webtest_; | 126 Webtest* webtest_; |
128 mus::Window* content_area_ = nullptr; | 127 mus::Window* content_area_ = nullptr; |
129 navigation::mojom::ViewPtr view_; | 128 navigation::mojom::ViewPtr view_; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 AddWindow(window); | 185 AddWindow(window); |
187 } | 186 } |
188 | 187 |
189 void Webtest::Create(shell::Connection* connection, | 188 void Webtest::Create(shell::Connection* connection, |
190 mojom::LaunchableRequest request) { | 189 mojom::LaunchableRequest request) { |
191 bindings_.AddBinding(this, std::move(request)); | 190 bindings_.AddBinding(this, std::move(request)); |
192 } | 191 } |
193 | 192 |
194 } // namespace webtest | 193 } // namespace webtest |
195 } // namespace mash | 194 } // namespace mash |
OLD | NEW |