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/browser/browser.h" | 5 #include "mash/browser/browser.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/gfx/text_constants.h" | 26 #include "ui/gfx/text_constants.h" |
28 #include "ui/native_theme/native_theme.h" | 27 #include "ui/native_theme/native_theme.h" |
29 #include "ui/views/background.h" | 28 #include "ui/views/background.h" |
30 #include "ui/views/controls/button/label_button.h" | 29 #include "ui/views/controls/button/label_button.h" |
31 #include "ui/views/controls/textfield/textfield.h" | 30 #include "ui/views/controls/textfield/textfield.h" |
32 #include "ui/views/controls/textfield/textfield_controller.h" | 31 #include "ui/views/controls/textfield/textfield_controller.h" |
33 #include "ui/views/mus/aura_init.h" | 32 #include "ui/views/mus/aura_init.h" |
34 #include "ui/views/mus/window_manager_connection.h" | 33 #include "ui/views/mus/window_manager_connection.h" |
35 #include "ui/views/widget/widget_delegate.h" | 34 #include "ui/views/widget/widget_delegate.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 prompt_->SetText(base::UTF8ToUTF16(url.spec())); | 272 prompt_->SetText(base::UTF8ToUTF16(url.spec())); |
274 current_title_ = base::UTF8ToUTF16(title.get()); | 273 current_title_ = base::UTF8ToUTF16(title.get()); |
275 GetWidget()->UpdateWindowTitle(); | 274 GetWidget()->UpdateWindowTitle(); |
276 } | 275 } |
277 void LoadProgressChanged(double progress) override { | 276 void LoadProgressChanged(double progress) override { |
278 progress_bar_->SetProgress(progress); | 277 progress_bar_->SetProgress(progress); |
279 } | 278 } |
280 void ViewCreated(navigation::mojom::ViewPtr view, | 279 void ViewCreated(navigation::mojom::ViewPtr view, |
281 navigation::mojom::ViewClientRequest request, | 280 navigation::mojom::ViewClientRequest request, |
282 bool is_popup, | 281 bool is_popup, |
283 mojo::RectPtr initial_rect, | 282 const gfx::Rect& initial_rect, |
284 bool user_gesture) override { | 283 bool user_gesture) override { |
285 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( | 284 views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( |
286 new UI(browser_, is_popup ? UI::Type::POPUP : UI::Type::WINDOW, | 285 new UI(browser_, is_popup ? UI::Type::POPUP : UI::Type::WINDOW, |
287 std::move(view), std::move(request)), | 286 std::move(view), std::move(request)), |
288 nullptr, initial_rect.To<gfx::Rect>()); | 287 nullptr, initial_rect); |
289 window->Show(); | 288 window->Show(); |
290 browser_->AddWindow(window); | 289 browser_->AddWindow(window); |
291 } | 290 } |
292 void Close() override { GetWidget()->Close(); } | 291 void Close() override { GetWidget()->Close(); } |
293 | 292 |
294 Browser* browser_; | 293 Browser* browser_; |
295 | 294 |
296 Type type_; | 295 Type type_; |
297 | 296 |
298 views::LabelButton* back_button_; | 297 views::LabelButton* back_button_; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 AddWindow(window); | 366 AddWindow(window); |
368 } | 367 } |
369 | 368 |
370 void Browser::Create(shell::Connection* connection, | 369 void Browser::Create(shell::Connection* connection, |
371 mojom::LaunchableRequest request) { | 370 mojom::LaunchableRequest request) { |
372 bindings_.AddBinding(this, std::move(request)); | 371 bindings_.AddBinding(this, std::move(request)); |
373 } | 372 } |
374 | 373 |
375 } // namespace browser | 374 } // namespace browser |
376 } // namespace mash | 375 } // namespace mash |
OLD | NEW |