| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mandoline/ui/desktop_ui/browser_window.h" | 5 #include "mandoline/ui/desktop_ui/browser_window.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
| 12 #include "components/mus/public/cpp/event_matcher.h" | 12 #include "components/mus/public/cpp/event_matcher.h" |
| 13 #include "components/mus/public/cpp/scoped_window_ptr.h" | 13 #include "components/mus/public/cpp/scoped_window_ptr.h" |
| 14 #include "components/mus/public/cpp/window_tree_host_factory.h" | 14 #include "components/mus/public/cpp/window_tree_host_factory.h" |
| 15 #include "mandoline/ui/common/util.h" | |
| 16 #include "mandoline/ui/desktop_ui/browser_commands.h" | 15 #include "mandoline/ui/desktop_ui/browser_commands.h" |
| 17 #include "mandoline/ui/desktop_ui/browser_manager.h" | 16 #include "mandoline/ui/desktop_ui/browser_manager.h" |
| 18 #include "mandoline/ui/desktop_ui/find_bar_view.h" | 17 #include "mandoline/ui/desktop_ui/find_bar_view.h" |
| 19 #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h" | 18 #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h" |
| 20 #include "mandoline/ui/desktop_ui/toolbar_view.h" | 19 #include "mandoline/ui/desktop_ui/toolbar_view.h" |
| 21 #include "mojo/common/common_type_converters.h" | 20 #include "mojo/common/common_type_converters.h" |
| 22 #include "mojo/converters/geometry/geometry_type_converters.h" | 21 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 23 #include "mojo/services/tracing/public/cpp/switches.h" | 22 #include "mojo/services/tracing/public/cpp/switches.h" |
| 24 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" | 23 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" |
| 25 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
| 26 #include "ui/mojo/init/ui_init.h" | 25 #include "ui/mojo/init/ui_init.h" |
| 27 #include "ui/views/background.h" | 26 #include "ui/views/background.h" |
| 28 #include "ui/views/controls/button/label_button.h" | 27 #include "ui/views/controls/button/label_button.h" |
| 29 #include "ui/views/mus/aura_init.h" | 28 #include "ui/views/mus/aura_init.h" |
| 29 #include "ui/views/mus/display_converter.h" |
| 30 #include "ui/views/mus/native_widget_view_manager.h" | 30 #include "ui/views/mus/native_widget_view_manager.h" |
| 31 #include "ui/views/widget/widget_delegate.h" | 31 #include "ui/views/widget/widget_delegate.h" |
| 32 | 32 |
| 33 namespace mandoline { | 33 namespace mandoline { |
| 34 | 34 |
| 35 class ProgressView : public views::View { | 35 class ProgressView : public views::View { |
| 36 public: | 36 public: |
| 37 ProgressView() : progress_(0.f), loading_(false) {} | 37 ProgressView() : progress_(0.f), loading_(false) {} |
| 38 ~ProgressView() override {} | 38 ~ProgressView() override {} |
| 39 | 39 |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 find_bar_view_->Hide(); | 385 find_bar_view_->Hide(); |
| 386 web_view_.web_view()->StopFinding(); | 386 web_view_.web_view()->StopFinding(); |
| 387 } | 387 } |
| 388 | 388 |
| 389 //////////////////////////////////////////////////////////////////////////////// | 389 //////////////////////////////////////////////////////////////////////////////// |
| 390 // BrowserWindow, private: | 390 // BrowserWindow, private: |
| 391 | 391 |
| 392 void BrowserWindow::Init(mus::Window* root) { | 392 void BrowserWindow::Init(mus::Window* root) { |
| 393 DCHECK_GT(root->viewport_metrics().device_pixel_ratio, 0); | 393 DCHECK_GT(root->viewport_metrics().device_pixel_ratio, 0); |
| 394 if (!aura_init_) { | 394 if (!aura_init_) { |
| 395 ui_init_.reset(new ui::mojo::UIInit(GetDisplaysFromWindow(root))); | 395 ui_init_.reset(new ui::mojo::UIInit(views::GetDisplaysFromWindow(root))); |
| 396 aura_init_.reset(new views::AuraInit(app_, "mandoline_ui.pak")); | 396 aura_init_.reset(new views::AuraInit(app_, "mandoline_ui.pak")); |
| 397 } | 397 } |
| 398 | 398 |
| 399 root_ = root; | 399 root_ = root; |
| 400 omnibox_view_ = root_->connection()->NewWindow(); | 400 omnibox_view_ = root_->connection()->NewWindow(); |
| 401 root_->AddChild(omnibox_view_); | 401 root_->AddChild(omnibox_view_); |
| 402 | 402 |
| 403 views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView; | 403 views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView; |
| 404 widget_delegate->GetContentsView()->set_background( | 404 widget_delegate->GetContentsView()->set_background( |
| 405 views::Background::CreateSolidBackground(0xFFDDDDDD)); | 405 views::Background::CreateSolidBackground(0xFFDDDDDD)); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 430 omnibox_view_->Embed(view_tree_client.Pass()); | 430 omnibox_view_->Embed(view_tree_client.Pass()); |
| 431 | 431 |
| 432 // TODO(beng): This should be handled sufficiently by | 432 // TODO(beng): This should be handled sufficiently by |
| 433 // OmniboxImpl::ShowWindow() but unfortunately view manager policy | 433 // OmniboxImpl::ShowWindow() but unfortunately view manager policy |
| 434 // currently prevents the embedded app from changing window z for | 434 // currently prevents the embedded app from changing window z for |
| 435 // its own window. | 435 // its own window. |
| 436 omnibox_view_->MoveToFront(); | 436 omnibox_view_->MoveToFront(); |
| 437 } | 437 } |
| 438 | 438 |
| 439 } // namespace mandoline | 439 } // namespace mandoline |
| OLD | NEW |