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

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

Issue 1421483003: mandoline: Start adding trace events for mandoline stuff. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with ToT Created 5 years, 1 month 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 | « components/web_view/frame.cc ('k') | sql/mojo/mojo_vfs.cc » ('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 "base/trace_event/trace_event.h"
11 #include "components/mus/public/cpp/event_matcher.h" 12 #include "components/mus/public/cpp/event_matcher.h"
12 #include "components/mus/public/cpp/scoped_window_ptr.h" 13 #include "components/mus/public/cpp/scoped_window_ptr.h"
13 #include "components/mus/public/cpp/window_tree_host_factory.h" 14 #include "components/mus/public/cpp/window_tree_host_factory.h"
14 #include "mandoline/ui/desktop_ui/browser_commands.h" 15 #include "mandoline/ui/desktop_ui/browser_commands.h"
15 #include "mandoline/ui/desktop_ui/browser_manager.h" 16 #include "mandoline/ui/desktop_ui/browser_manager.h"
16 #include "mandoline/ui/desktop_ui/find_bar_view.h" 17 #include "mandoline/ui/desktop_ui/find_bar_view.h"
17 #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h" 18 #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h"
18 #include "mandoline/ui/desktop_ui/toolbar_view.h" 19 #include "mandoline/ui/desktop_ui/toolbar_view.h"
19 #include "mojo/common/common_type_converters.h" 20 #include "mojo/common/common_type_converters.h"
20 #include "mojo/converters/geometry/geometry_type_converters.h" 21 #include "mojo/converters/geometry/geometry_type_converters.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 108 }
108 109
109 void BrowserWindow::Close() { 110 void BrowserWindow::Close() {
110 if (root_) 111 if (root_)
111 mus::ScopedWindowPtr::DeleteWindowOrWindowManager(root_); 112 mus::ScopedWindowPtr::DeleteWindowOrWindowManager(root_);
112 else 113 else
113 delete this; 114 delete this;
114 } 115 }
115 116
116 void BrowserWindow::ShowOmnibox() { 117 void BrowserWindow::ShowOmnibox() {
118 TRACE_EVENT0("desktop_ui", "BrowserWindow::ShowOmnibox");
117 if (!omnibox_.get()) { 119 if (!omnibox_.get()) {
118 mojo::URLRequestPtr request(mojo::URLRequest::New()); 120 mojo::URLRequestPtr request(mojo::URLRequest::New());
119 request->url = mojo::String::From("mojo:omnibox"); 121 request->url = mojo::String::From("mojo:omnibox");
120 omnibox_connection_ = app_->ConnectToApplication(request.Pass()); 122 omnibox_connection_ = app_->ConnectToApplication(request.Pass());
121 omnibox_connection_->AddService<ViewEmbedder>(this); 123 omnibox_connection_->AddService<ViewEmbedder>(this);
122 omnibox_connection_->ConnectToService(&omnibox_); 124 omnibox_connection_->ConnectToService(&omnibox_);
123 omnibox_connection_->SetRemoteServiceProviderConnectionErrorHandler( 125 omnibox_connection_->SetRemoteServiceProviderConnectionErrorHandler(
124 [this]() { 126 [this]() {
125 // This will cause the connection to be re-established the next time 127 // This will cause the connection to be re-established the next time
126 // we come through this codepath. 128 // we come through this codepath.
127 omnibox_.reset(); 129 omnibox_.reset();
128 }); 130 });
129 } 131 }
130 omnibox_->ShowForURL(mojo::String::From(current_url_.spec())); 132 omnibox_->ShowForURL(mojo::String::From(current_url_.spec()));
131 } 133 }
132 134
133 void BrowserWindow::ShowFind() { 135 void BrowserWindow::ShowFind() {
136 TRACE_EVENT0("desktop_ui", "BrowserWindow::ShowFind");
134 toolbar_view_->SetVisible(false); 137 toolbar_view_->SetVisible(false);
135 find_bar_view_->Show(); 138 find_bar_view_->Show();
136 } 139 }
137 140
138 void BrowserWindow::GoBack() { 141 void BrowserWindow::GoBack() {
142 TRACE_EVENT0("desktop_ui", "BrowserWindow::GoBack");
139 web_view_.web_view()->GoBack(); 143 web_view_.web_view()->GoBack();
140 } 144 }
141 145
142 void BrowserWindow::GoForward() { 146 void BrowserWindow::GoForward() {
147 TRACE_EVENT0("desktop_ui", "BrowserWindow::GoForward");
143 web_view_.web_view()->GoForward(); 148 web_view_.web_view()->GoForward();
144 } 149 }
145 150
146 BrowserWindow::~BrowserWindow() { 151 BrowserWindow::~BrowserWindow() {
147 DCHECK(!root_); 152 DCHECK(!root_);
148 manager_->BrowserWindowClosed(this); 153 manager_->BrowserWindowClosed(this);
149 } 154 }
150 155
151 float BrowserWindow::DIPSToPixels(float value) const { 156 float BrowserWindow::DIPSToPixels(float value) const {
152 return value * root_->viewport_metrics().device_pixel_ratio; 157 return value * root_->viewport_metrics().device_pixel_ratio;
153 } 158 }
154 159
155 //////////////////////////////////////////////////////////////////////////////// 160 ////////////////////////////////////////////////////////////////////////////////
156 // BrowserWindow, mus::ViewTreeDelegate implementation: 161 // BrowserWindow, mus::ViewTreeDelegate implementation:
157 162
158 void BrowserWindow::OnEmbed(mus::Window* root) { 163 void BrowserWindow::OnEmbed(mus::Window* root) {
164 TRACE_EVENT0("desktop_ui", "BrowserWindow::OnEmbed");
159 // BrowserWindow does not support being embedded more than once. 165 // BrowserWindow does not support being embedded more than once.
160 CHECK(!root_); 166 CHECK(!root_);
161 167
162 // Record when the browser window was displayed, used for performance testing. 168 // Record when the browser window was displayed, used for performance testing.
163 const base::Time display_time = base::Time::Now(); 169 const base::Time display_time = base::Time::Now();
164 170
165 root_ = root; 171 root_ = root;
166 172
167 host_->SetTitle("Mandoline"); 173 host_->SetTitle("Mandoline");
168 174
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 omnibox_view_->Embed(view_tree_client.Pass()); 420 omnibox_view_->Embed(view_tree_client.Pass());
415 421
416 // TODO(beng): This should be handled sufficiently by 422 // TODO(beng): This should be handled sufficiently by
417 // OmniboxImpl::ShowWindow() but unfortunately view manager policy 423 // OmniboxImpl::ShowWindow() but unfortunately view manager policy
418 // currently prevents the embedded app from changing window z for 424 // currently prevents the embedded app from changing window z for
419 // its own window. 425 // its own window.
420 omnibox_view_->MoveToFront(); 426 omnibox_view_->MoveToFront();
421 } 427 }
422 428
423 } // namespace mandoline 429 } // namespace mandoline
OLDNEW
« no previous file with comments | « components/web_view/frame.cc ('k') | sql/mojo/mojo_vfs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698