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

Side by Side Diff: mandoline/ui/desktop_ui/browser_window.cc

Issue 1402213002: Moves mandoline/ui/aura to ui/views/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable presubmit Created 5 years, 2 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
« no previous file with comments | « mandoline/ui/desktop_ui/browser_window.h ('k') | mandoline/ui/omnibox/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/mus/public/cpp/scoped_view_ptr.h" 11 #include "components/mus/public/cpp/scoped_view_ptr.h"
12 #include "components/mus/public/cpp/view_tree_host_factory.h" 12 #include "components/mus/public/cpp/view_tree_host_factory.h"
13 #include "mandoline/ui/aura/native_widget_view_manager.h"
14 #include "mandoline/ui/desktop_ui/browser_commands.h" 13 #include "mandoline/ui/desktop_ui/browser_commands.h"
15 #include "mandoline/ui/desktop_ui/browser_manager.h" 14 #include "mandoline/ui/desktop_ui/browser_manager.h"
16 #include "mandoline/ui/desktop_ui/find_bar_view.h" 15 #include "mandoline/ui/desktop_ui/find_bar_view.h"
17 #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h" 16 #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h"
18 #include "mandoline/ui/desktop_ui/toolbar_view.h" 17 #include "mandoline/ui/desktop_ui/toolbar_view.h"
19 #include "mojo/common/common_type_converters.h" 18 #include "mojo/common/common_type_converters.h"
20 #include "mojo/converters/geometry/geometry_type_converters.h" 19 #include "mojo/converters/geometry/geometry_type_converters.h"
21 #include "mojo/services/tracing/public/cpp/switches.h" 20 #include "mojo/services/tracing/public/cpp/switches.h"
22 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" 21 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
23 #include "ui/gfx/canvas.h" 22 #include "ui/gfx/canvas.h"
24 #include "ui/views/background.h" 23 #include "ui/views/background.h"
25 #include "ui/views/controls/button/label_button.h" 24 #include "ui/views/controls/button/label_button.h"
25 #include "ui/views/mus/native_widget_view_manager.h"
26 #include "ui/views/widget/widget_delegate.h" 26 #include "ui/views/widget/widget_delegate.h"
27 27
28 namespace mandoline { 28 namespace mandoline {
29 29
30 class ProgressView : public views::View { 30 class ProgressView : public views::View {
31 public: 31 public:
32 ProgressView() : progress_(0.f), loading_(false) {} 32 ProgressView() : progress_(0.f), loading_(false) {}
33 ~ProgressView() override {} 33 ~ProgressView() override {}
34 34
35 void SetProgress(double progress) { 35 void SetProgress(double progress) {
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 find_bar_view_->Hide(); 366 find_bar_view_->Hide();
367 web_view_.web_view()->StopFinding(); 367 web_view_.web_view()->StopFinding();
368 } 368 }
369 369
370 //////////////////////////////////////////////////////////////////////////////// 370 ////////////////////////////////////////////////////////////////////////////////
371 // BrowserWindow, private: 371 // BrowserWindow, private:
372 372
373 void BrowserWindow::Init(mus::View* root) { 373 void BrowserWindow::Init(mus::View* root) {
374 DCHECK_GT(root->viewport_metrics().device_pixel_ratio, 0); 374 DCHECK_GT(root->viewport_metrics().device_pixel_ratio, 0);
375 if (!aura_init_) 375 if (!aura_init_)
376 aura_init_.reset(new AuraInit(root, app_->shell(), "mandoline_ui.pak")); 376 aura_init_.reset(
377 new views::AuraInit(root, app_->shell(), "mandoline_ui.pak"));
377 378
378 root_ = root; 379 root_ = root;
379 omnibox_view_ = root_->connection()->CreateView(); 380 omnibox_view_ = root_->connection()->CreateView();
380 root_->AddChild(omnibox_view_); 381 root_->AddChild(omnibox_view_);
381 382
382 views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView; 383 views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView;
383 widget_delegate->GetContentsView()->set_background( 384 widget_delegate->GetContentsView()->set_background(
384 views::Background::CreateSolidBackground(0xFFDDDDDD)); 385 views::Background::CreateSolidBackground(0xFFDDDDDD));
385 toolbar_view_ = new ToolbarView(this); 386 toolbar_view_ = new ToolbarView(this);
386 progress_bar_ = new ProgressView; 387 progress_bar_ = new ProgressView;
387 widget_delegate->GetContentsView()->AddChildView(toolbar_view_); 388 widget_delegate->GetContentsView()->AddChildView(toolbar_view_);
388 widget_delegate->GetContentsView()->AddChildView(progress_bar_); 389 widget_delegate->GetContentsView()->AddChildView(progress_bar_);
389 widget_delegate->GetContentsView()->SetLayoutManager(this); 390 widget_delegate->GetContentsView()->SetLayoutManager(this);
390 391
391 find_bar_view_ = new FindBarView(this); 392 find_bar_view_ = new FindBarView(this);
392 widget_delegate->GetContentsView()->AddChildView(find_bar_view_); 393 widget_delegate->GetContentsView()->AddChildView(find_bar_view_);
393 394
394 views::Widget* widget = new views::Widget; 395 views::Widget* widget = new views::Widget;
395 views::Widget::InitParams params( 396 views::Widget::InitParams params(
396 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 397 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
397 params.native_widget = 398 params.native_widget =
398 new NativeWidgetViewManager(widget, app_->shell(), root_); 399 new views::NativeWidgetViewManager(widget, app_->shell(), root_);
399 params.delegate = widget_delegate; 400 params.delegate = widget_delegate;
400 params.bounds = root_->bounds().To<gfx::Rect>(); 401 params.bounds = root_->bounds().To<gfx::Rect>();
401 widget->Init(params); 402 widget->Init(params);
402 widget->Show(); 403 widget->Show();
403 root_->SetFocus(); 404 root_->SetFocus();
404 } 405 }
405 406
406 void BrowserWindow::EmbedOmnibox() { 407 void BrowserWindow::EmbedOmnibox() {
407 mojo::ViewTreeClientPtr view_tree_client; 408 mojo::ViewTreeClientPtr view_tree_client;
408 omnibox_->GetViewTreeClient(GetProxy(&view_tree_client)); 409 omnibox_->GetViewTreeClient(GetProxy(&view_tree_client));
409 omnibox_view_->Embed(view_tree_client.Pass()); 410 omnibox_view_->Embed(view_tree_client.Pass());
410 411
411 // TODO(beng): This should be handled sufficiently by 412 // TODO(beng): This should be handled sufficiently by
412 // OmniboxImpl::ShowWindow() but unfortunately view manager policy 413 // OmniboxImpl::ShowWindow() but unfortunately view manager policy
413 // currently prevents the embedded app from changing window z for 414 // currently prevents the embedded app from changing window z for
414 // its own window. 415 // its own window.
415 omnibox_view_->MoveToFront(); 416 omnibox_view_->MoveToFront();
416 } 417 }
417 418
418 } // namespace mandoline 419 } // namespace mandoline
OLDNEW
« no previous file with comments | « mandoline/ui/desktop_ui/browser_window.h ('k') | mandoline/ui/omnibox/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698