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 "components/view_manager/public/cpp/scoped_view_ptr.h" | 11 #include "components/view_manager/public/cpp/scoped_view_ptr.h" |
12 #include "components/view_manager/public/cpp/view_tree_host_factory.h" | 12 #include "components/view_manager/public/cpp/view_tree_host_factory.h" |
13 #include "mandoline/ui/aura/native_widget_view_manager.h" | 13 #include "mandoline/ui/aura/native_widget_view_manager.h" |
14 #include "mandoline/ui/desktop_ui/browser_commands.h" | 14 #include "mandoline/ui/desktop_ui/browser_commands.h" |
15 #include "mandoline/ui/desktop_ui/browser_manager.h" | 15 #include "mandoline/ui/desktop_ui/browser_manager.h" |
16 #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h" | 16 #include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h" |
17 #include "mojo/common/common_type_converters.h" | 17 #include "mojo/common/common_type_converters.h" |
18 #include "mojo/converters/geometry/geometry_type_converters.h" | 18 #include "mojo/converters/geometry/geometry_type_converters.h" |
19 #include "mojo/services/tracing/public/cpp/switches.h" | 19 #include "mojo/services/tracing/public/cpp/switches.h" |
20 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" | 20 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" |
21 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
22 #include "ui/views/background.h" | 22 #include "ui/views/background.h" |
23 #include "ui/views/controls/button/label_button.h" | 23 #include "ui/views/controls/button/label_button.h" |
24 #include "ui/views/layout/grid_layout.h" | |
24 #include "ui/views/widget/widget_delegate.h" | 25 #include "ui/views/widget/widget_delegate.h" |
25 | 26 |
26 namespace mandoline { | 27 namespace mandoline { |
27 | 28 |
29 using views::GridLayout; | |
30 | |
31 class BrowserWindow::ToolbarView : public views::View, | |
32 public views::ButtonListener { | |
33 public: | |
34 ToolbarView(BrowserWindow* browser_window) | |
35 : browser_window_(browser_window), | |
36 layout_(new views::GridLayout(this)), | |
37 back_button_(new views::LabelButton(this, base::ASCIIToUTF16("Back"))), | |
msw
2015/09/04 22:05:00
lol, "Back" string...
| |
38 forward_button_( | |
39 new views::LabelButton(this, base::ASCIIToUTF16("Forward"))), | |
40 omnibox_launcher_( | |
41 new views::LabelButton(this, base::ASCIIToUTF16("Open Omnibox"))) { | |
42 SetLayoutManager(layout_); | |
msw
2015/09/04 22:05:00
BoxLayout might be simpler, I think it's got some
Elliot Glaysher
2015/09/04 22:54:48
Switched to BoxLayout.
| |
43 | |
44 views::ColumnSet* columns = layout_->AddColumnSet(0); | |
45 columns->AddColumn(GridLayout::FILL, GridLayout::FILL, 0, | |
46 GridLayout::USE_PREF, 0, 0); | |
47 columns->AddColumn(GridLayout::FILL, GridLayout::FILL, 0, | |
48 GridLayout::USE_PREF, 0, 0); | |
49 columns->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | |
50 GridLayout::USE_PREF, 0, 0); | |
51 | |
52 layout_->StartRow(0, 0); | |
53 layout_->AddView(back_button_); | |
54 layout_->AddView(forward_button_); | |
55 layout_->AddView(omnibox_launcher_); | |
56 } | |
57 | |
58 ~ToolbarView() override {} | |
59 | |
60 void SetOmniboxText(const base::string16& text) { | |
61 omnibox_launcher_->SetText(text); | |
62 } | |
63 | |
64 void SetBackForwardEnabled(bool back_enabled, bool forward_enabled) { | |
msw
2015/09/04 22:05:00
nit: "backward" in function and arg name to match
| |
65 back_button_->SetEnabled(back_enabled); | |
66 forward_button_->SetEnabled(forward_enabled); | |
67 } | |
68 | |
69 // Overridden from views::ButtonListener: | |
70 void ButtonPressed(views::Button* sender, const ui::Event& event) override { | |
71 if (sender == omnibox_launcher_) | |
72 browser_window_->ShowOmnibox(); | |
73 else if (sender == back_button_) | |
74 browser_window_->GoBack(); | |
75 else if (sender == forward_button_) | |
76 browser_window_->GoForward(); | |
77 else | |
78 NOTIMPLEMENTED(); | |
79 } | |
80 | |
81 private: | |
82 BrowserWindow* browser_window_; | |
83 | |
84 views::GridLayout* layout_; | |
85 views::LabelButton* back_button_; | |
86 views::LabelButton* forward_button_; | |
87 views::LabelButton* omnibox_launcher_; | |
88 | |
89 DISALLOW_COPY_AND_ASSIGN(ToolbarView); | |
90 }; | |
91 | |
28 class ProgressView : public views::View { | 92 class ProgressView : public views::View { |
29 public: | 93 public: |
30 ProgressView() : progress_(0.f), loading_(false) {} | 94 ProgressView() : progress_(0.f), loading_(false) {} |
31 ~ProgressView() override {} | 95 ~ProgressView() override {} |
32 | 96 |
33 void SetProgress(double progress) { | 97 void SetProgress(double progress) { |
34 progress_ = progress; | 98 progress_ = progress; |
35 SchedulePaint(); | 99 SchedulePaint(); |
36 } | 100 } |
37 | 101 |
(...skipping 26 matching lines...) Expand all Loading... | |
64 | 128 |
65 //////////////////////////////////////////////////////////////////////////////// | 129 //////////////////////////////////////////////////////////////////////////////// |
66 // BrowserWindow, public: | 130 // BrowserWindow, public: |
67 | 131 |
68 BrowserWindow::BrowserWindow(mojo::ApplicationImpl* app, | 132 BrowserWindow::BrowserWindow(mojo::ApplicationImpl* app, |
69 mojo::ViewTreeHostFactory* host_factory, | 133 mojo::ViewTreeHostFactory* host_factory, |
70 BrowserManager* manager) | 134 BrowserManager* manager) |
71 : app_(app), | 135 : app_(app), |
72 host_client_binding_(this), | 136 host_client_binding_(this), |
73 manager_(manager), | 137 manager_(manager), |
74 omnibox_launcher_(nullptr), | 138 toolbar_view_(nullptr), |
75 progress_bar_(nullptr), | 139 progress_bar_(nullptr), |
76 root_(nullptr), | 140 root_(nullptr), |
77 content_(nullptr), | 141 content_(nullptr), |
78 omnibox_view_(nullptr), | 142 omnibox_view_(nullptr), |
79 web_view_(this) { | 143 web_view_(this) { |
80 mojo::ViewTreeHostClientPtr host_client; | 144 mojo::ViewTreeHostClientPtr host_client; |
81 host_client_binding_.Bind(GetProxy(&host_client)); | 145 host_client_binding_.Bind(GetProxy(&host_client)); |
82 mojo::CreateViewTreeHost(host_factory, host_client.Pass(), this, &host_); | 146 mojo::CreateViewTreeHost(host_factory, host_client.Pass(), this, &host_); |
83 } | 147 } |
84 | 148 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 content_->SetAccessPolicy(mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT); | 205 content_->SetAccessPolicy(mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT); |
142 | 206 |
143 web_view_.Init(app_, content_); | 207 web_view_.Init(app_, content_); |
144 | 208 |
145 host_->AddAccelerator(BrowserCommand_Close, mojo::KEYBOARD_CODE_W, | 209 host_->AddAccelerator(BrowserCommand_Close, mojo::KEYBOARD_CODE_W, |
146 mojo::EVENT_FLAGS_CONTROL_DOWN); | 210 mojo::EVENT_FLAGS_CONTROL_DOWN); |
147 host_->AddAccelerator(BrowserCommand_FocusOmnibox, mojo::KEYBOARD_CODE_L, | 211 host_->AddAccelerator(BrowserCommand_FocusOmnibox, mojo::KEYBOARD_CODE_L, |
148 mojo::EVENT_FLAGS_CONTROL_DOWN); | 212 mojo::EVENT_FLAGS_CONTROL_DOWN); |
149 host_->AddAccelerator(BrowserCommand_NewWindow, mojo::KEYBOARD_CODE_N, | 213 host_->AddAccelerator(BrowserCommand_NewWindow, mojo::KEYBOARD_CODE_N, |
150 mojo::EVENT_FLAGS_CONTROL_DOWN); | 214 mojo::EVENT_FLAGS_CONTROL_DOWN); |
215 host_->AddAccelerator(BrowserCommand_GoBack, mojo::KEYBOARD_CODE_LEFT, | |
216 mojo::EVENT_FLAGS_ALT_DOWN); | |
217 host_->AddAccelerator(BrowserCommand_GoForward, mojo::KEYBOARD_CODE_RIGHT, | |
218 mojo::EVENT_FLAGS_ALT_DOWN); | |
151 | 219 |
152 // Now that we're ready, load the default url. | 220 // Now that we're ready, load the default url. |
153 LoadURL(default_url_); | 221 LoadURL(default_url_); |
154 | 222 |
155 // Record the time spent opening initial tabs, used for performance testing. | 223 // Record the time spent opening initial tabs, used for performance testing. |
156 const base::TimeDelta open_tabs_delta = base::Time::Now() - display_time; | 224 const base::TimeDelta open_tabs_delta = base::Time::Now() - display_time; |
157 | 225 |
158 // Record the browser startup time metrics, used for performance testing. | 226 // Record the browser startup time metrics, used for performance testing. |
159 static bool recorded_browser_startup_metrics = false; | 227 static bool recorded_browser_startup_metrics = false; |
160 if (!recorded_browser_startup_metrics && | 228 if (!recorded_browser_startup_metrics && |
(...skipping 23 matching lines...) Expand all Loading... | |
184 switch (id) { | 252 switch (id) { |
185 case BrowserCommand_Close: | 253 case BrowserCommand_Close: |
186 Close(); | 254 Close(); |
187 break; | 255 break; |
188 case BrowserCommand_NewWindow: | 256 case BrowserCommand_NewWindow: |
189 manager_->CreateBrowser(GURL()); | 257 manager_->CreateBrowser(GURL()); |
190 break; | 258 break; |
191 case BrowserCommand_FocusOmnibox: | 259 case BrowserCommand_FocusOmnibox: |
192 ShowOmnibox(); | 260 ShowOmnibox(); |
193 break; | 261 break; |
262 case BrowserCommand_GoBack: | |
263 GoBack(); | |
264 break; | |
265 case BrowserCommand_GoForward: | |
266 GoForward(); | |
267 break; | |
194 default: | 268 default: |
195 NOTREACHED(); | 269 NOTREACHED(); |
196 break; | 270 break; |
197 } | 271 } |
198 } | 272 } |
199 | 273 |
200 //////////////////////////////////////////////////////////////////////////////// | 274 //////////////////////////////////////////////////////////////////////////////// |
201 // BrowserWindow, web_view::mojom::WebViewClient implementation: | 275 // BrowserWindow, web_view::mojom::WebViewClient implementation: |
202 | 276 |
203 void BrowserWindow::TopLevelNavigate(mojo::URLRequestPtr request) { | 277 void BrowserWindow::TopLevelNavigate(mojo::URLRequestPtr request) { |
204 Embed(request.Pass()); | 278 Embed(request.Pass()); |
205 } | 279 } |
206 | 280 |
207 void BrowserWindow::LoadingStateChanged(bool is_loading) { | 281 void BrowserWindow::LoadingStateChanged(bool is_loading) { |
208 progress_bar_->SetIsLoading(is_loading); | 282 progress_bar_->SetIsLoading(is_loading); |
209 } | 283 } |
210 | 284 |
211 void BrowserWindow::ProgressChanged(double progress) { | 285 void BrowserWindow::ProgressChanged(double progress) { |
212 progress_bar_->SetProgress(progress); | 286 progress_bar_->SetProgress(progress); |
213 } | 287 } |
214 | 288 |
289 void BrowserWindow::BackForwardChanged(bool back_enabled, | |
290 bool forward_enabled) { | |
291 toolbar_view_->SetBackForwardEnabled(back_enabled, forward_enabled); | |
292 } | |
293 | |
215 void BrowserWindow::TitleChanged(const mojo::String& title) { | 294 void BrowserWindow::TitleChanged(const mojo::String& title) { |
216 base::string16 formatted = | 295 base::string16 formatted = |
217 title.is_null() ? base::ASCIIToUTF16("Untitled") | 296 title.is_null() ? base::ASCIIToUTF16("Untitled") |
218 : title.To<base::string16>() + | 297 : title.To<base::string16>() + |
219 base::ASCIIToUTF16(" - Mandoline"); | 298 base::ASCIIToUTF16(" - Mandoline"); |
220 host_->SetTitle(mojo::String::From(formatted)); | 299 host_->SetTitle(mojo::String::From(formatted)); |
221 } | 300 } |
222 | 301 |
223 //////////////////////////////////////////////////////////////////////////////// | 302 //////////////////////////////////////////////////////////////////////////////// |
224 // BrowserWindow, ViewEmbedder implementation: | 303 // BrowserWindow, ViewEmbedder implementation: |
225 | 304 |
226 void BrowserWindow::Embed(mojo::URLRequestPtr request) { | 305 void BrowserWindow::Embed(mojo::URLRequestPtr request) { |
227 const std::string string_url = request->url.To<std::string>(); | 306 const std::string string_url = request->url.To<std::string>(); |
228 if (string_url == "mojo:omnibox") { | 307 if (string_url == "mojo:omnibox") { |
229 EmbedOmnibox(); | 308 EmbedOmnibox(); |
230 return; | 309 return; |
231 } | 310 } |
232 | 311 |
233 GURL gurl(string_url); | 312 GURL gurl(string_url); |
234 bool changed = current_url_ != gurl; | 313 bool changed = current_url_ != gurl; |
235 current_url_ = gurl; | 314 current_url_ = gurl; |
236 if (changed) | 315 if (changed) |
237 omnibox_launcher_->SetText(base::UTF8ToUTF16(current_url_.spec())); | 316 toolbar_view_->SetOmniboxText(base::UTF8ToUTF16(current_url_.spec())); |
238 | 317 |
239 web_view_.web_view()->LoadRequest(request.Pass()); | 318 web_view_.web_view()->LoadRequest(request.Pass()); |
240 } | 319 } |
241 | 320 |
242 //////////////////////////////////////////////////////////////////////////////// | 321 //////////////////////////////////////////////////////////////////////////////// |
243 // BrowserWindow, mojo::InterfaceFactory<ViewEmbedder> implementation: | 322 // BrowserWindow, mojo::InterfaceFactory<ViewEmbedder> implementation: |
244 | 323 |
245 void BrowserWindow::Create(mojo::ApplicationConnection* connection, | 324 void BrowserWindow::Create(mojo::ApplicationConnection* connection, |
246 mojo::InterfaceRequest<ViewEmbedder> request) { | 325 mojo::InterfaceRequest<ViewEmbedder> request) { |
247 view_embedder_bindings_.AddBinding(this, request.Pass()); | 326 view_embedder_bindings_.AddBinding(this, request.Pass()); |
248 } | 327 } |
249 | 328 |
250 //////////////////////////////////////////////////////////////////////////////// | 329 //////////////////////////////////////////////////////////////////////////////// |
251 // BrowserWindow, views::LayoutManager implementation: | 330 // BrowserWindow, views::LayoutManager implementation: |
252 | 331 |
253 gfx::Size BrowserWindow::GetPreferredSize(const views::View* view) const { | 332 gfx::Size BrowserWindow::GetPreferredSize(const views::View* view) const { |
254 return gfx::Size(); | 333 return gfx::Size(); |
255 } | 334 } |
256 | 335 |
257 void BrowserWindow::Layout(views::View* host) { | 336 void BrowserWindow::Layout(views::View* host) { |
258 // TODO(fsamuel): All bounds should be in physical pixels. | 337 // TODO(fsamuel): All bounds should be in physical pixels. |
259 gfx::Rect bounds_in_physical_pixels(host->bounds()); | 338 gfx::Rect bounds_in_physical_pixels(host->bounds()); |
260 float inverse_device_pixel_ratio = | 339 float inverse_device_pixel_ratio = |
261 1.0f / root_->viewport_metrics().device_pixel_ratio; | 340 1.0f / root_->viewport_metrics().device_pixel_ratio; |
262 | 341 |
263 gfx::Rect omnibox_launcher_bounds = | 342 gfx::Rect toolbar_bounds = gfx::ToEnclosingRect( |
264 gfx::ToEnclosingRect(gfx::ScaleRect(bounds_in_physical_pixels, | 343 gfx::ScaleRect(bounds_in_physical_pixels, inverse_device_pixel_ratio)); |
265 inverse_device_pixel_ratio)); | 344 toolbar_bounds.Inset(10, 10, 10, toolbar_bounds.height() - 40); |
266 omnibox_launcher_bounds.Inset(10, 10, 10, | 345 toolbar_view_->SetBoundsRect(toolbar_bounds); |
267 omnibox_launcher_bounds.height() - 40); | |
268 omnibox_launcher_->SetBoundsRect(omnibox_launcher_bounds); | |
269 | 346 |
270 gfx::Rect progress_bar_bounds(omnibox_launcher_bounds.x(), | 347 gfx::Rect progress_bar_bounds(toolbar_bounds.x(), toolbar_bounds.bottom() + 2, |
271 omnibox_launcher_bounds.bottom() + 2, | 348 toolbar_bounds.width(), 5); |
272 omnibox_launcher_bounds.width(), | |
273 5); | |
274 progress_bar_->SetBoundsRect(progress_bar_bounds); | 349 progress_bar_->SetBoundsRect(progress_bar_bounds); |
275 | 350 |
276 // The content view bounds are in physical pixels. | 351 // The content view bounds are in physical pixels. |
277 mojo::Rect content_bounds_mojo; | 352 mojo::Rect content_bounds_mojo; |
278 content_bounds_mojo.x = DIPSToPixels(progress_bar_bounds.x()); | 353 content_bounds_mojo.x = DIPSToPixels(progress_bar_bounds.x()); |
279 content_bounds_mojo.y = DIPSToPixels(progress_bar_bounds.bottom()+ 10); | 354 content_bounds_mojo.y = DIPSToPixels(progress_bar_bounds.bottom()+ 10); |
280 content_bounds_mojo.width = DIPSToPixels(progress_bar_bounds.width()); | 355 content_bounds_mojo.width = DIPSToPixels(progress_bar_bounds.width()); |
281 content_bounds_mojo.height = | 356 content_bounds_mojo.height = |
282 host->bounds().height() - content_bounds_mojo.y - DIPSToPixels(10); | 357 host->bounds().height() - content_bounds_mojo.y - DIPSToPixels(10); |
283 content_->SetBounds(content_bounds_mojo); | 358 content_->SetBounds(content_bounds_mojo); |
284 | 359 |
285 // The omnibox view bounds are in physical pixels. | 360 // The omnibox view bounds are in physical pixels. |
286 omnibox_view_->SetBounds( | 361 omnibox_view_->SetBounds( |
287 mojo::TypeConverter<mojo::Rect, gfx::Rect>::Convert( | 362 mojo::TypeConverter<mojo::Rect, gfx::Rect>::Convert( |
288 bounds_in_physical_pixels)); | 363 bounds_in_physical_pixels)); |
289 | |
290 } | 364 } |
291 | 365 |
292 //////////////////////////////////////////////////////////////////////////////// | 366 //////////////////////////////////////////////////////////////////////////////// |
293 // BrowserWindow, views::ButtonListener implementation: | |
294 | |
295 void BrowserWindow::ButtonPressed(views::Button* sender, | |
296 const ui::Event& event) { | |
297 DCHECK_EQ(sender, omnibox_launcher_); | |
298 ShowOmnibox(); | |
299 } | |
300 | |
301 //////////////////////////////////////////////////////////////////////////////// | |
302 // BrowserWindow, private: | 367 // BrowserWindow, private: |
303 | 368 |
304 void BrowserWindow::Init(mojo::View* root) { | 369 void BrowserWindow::Init(mojo::View* root) { |
305 DCHECK_GT(root->viewport_metrics().device_pixel_ratio, 0); | 370 DCHECK_GT(root->viewport_metrics().device_pixel_ratio, 0); |
306 if (!aura_init_) | 371 if (!aura_init_) |
307 aura_init_.reset(new AuraInit(root, app_->shell())); | 372 aura_init_.reset(new AuraInit(root, app_->shell())); |
308 | 373 |
309 root_ = root; | 374 root_ = root; |
310 omnibox_view_ = root_->connection()->CreateView(); | 375 omnibox_view_ = root_->connection()->CreateView(); |
311 root_->AddChild(omnibox_view_); | 376 root_->AddChild(omnibox_view_); |
312 | 377 |
313 views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView; | 378 views::WidgetDelegateView* widget_delegate = new views::WidgetDelegateView; |
314 widget_delegate->GetContentsView()->set_background( | 379 widget_delegate->GetContentsView()->set_background( |
315 views::Background::CreateSolidBackground(0xFFDDDDDD)); | 380 views::Background::CreateSolidBackground(0xFFDDDDDD)); |
316 omnibox_launcher_ = | 381 toolbar_view_ = new ToolbarView(this); |
317 new views::LabelButton(this, base::ASCIIToUTF16("Open Omnibox")); | |
318 progress_bar_ = new ProgressView; | 382 progress_bar_ = new ProgressView; |
319 | 383 widget_delegate->GetContentsView()->AddChildView(toolbar_view_); |
320 widget_delegate->GetContentsView()->AddChildView(omnibox_launcher_); | |
321 widget_delegate->GetContentsView()->AddChildView(progress_bar_); | 384 widget_delegate->GetContentsView()->AddChildView(progress_bar_); |
322 widget_delegate->GetContentsView()->SetLayoutManager(this); | 385 widget_delegate->GetContentsView()->SetLayoutManager(this); |
323 | 386 |
324 views::Widget* widget = new views::Widget; | 387 views::Widget* widget = new views::Widget; |
325 views::Widget::InitParams params( | 388 views::Widget::InitParams params( |
326 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 389 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
327 params.native_widget = | 390 params.native_widget = |
328 new NativeWidgetViewManager(widget, app_->shell(), root_); | 391 new NativeWidgetViewManager(widget, app_->shell(), root_); |
329 params.delegate = widget_delegate; | 392 params.delegate = widget_delegate; |
330 params.bounds = root_->bounds().To<gfx::Rect>(); | 393 params.bounds = root_->bounds().To<gfx::Rect>(); |
(...skipping 12 matching lines...) Expand all Loading... | |
343 omnibox_connection_->SetRemoteServiceProviderConnectionErrorHandler( | 406 omnibox_connection_->SetRemoteServiceProviderConnectionErrorHandler( |
344 [this]() { | 407 [this]() { |
345 // This will cause the connection to be re-established the next time | 408 // This will cause the connection to be re-established the next time |
346 // we come through this codepath. | 409 // we come through this codepath. |
347 omnibox_.reset(); | 410 omnibox_.reset(); |
348 }); | 411 }); |
349 } | 412 } |
350 omnibox_->ShowForURL(mojo::String::From(current_url_.spec())); | 413 omnibox_->ShowForURL(mojo::String::From(current_url_.spec())); |
351 } | 414 } |
352 | 415 |
416 void BrowserWindow::GoBack() { | |
417 web_view_.web_view()->GoBack(); | |
418 } | |
419 | |
420 void BrowserWindow::GoForward() { | |
421 web_view_.web_view()->GoForward(); | |
422 } | |
423 | |
353 void BrowserWindow::EmbedOmnibox() { | 424 void BrowserWindow::EmbedOmnibox() { |
354 mojo::ViewTreeClientPtr view_tree_client; | 425 mojo::ViewTreeClientPtr view_tree_client; |
355 omnibox_->GetViewTreeClient(GetProxy(&view_tree_client)); | 426 omnibox_->GetViewTreeClient(GetProxy(&view_tree_client)); |
356 omnibox_view_->Embed(view_tree_client.Pass()); | 427 omnibox_view_->Embed(view_tree_client.Pass()); |
357 | 428 |
358 // TODO(beng): This should be handled sufficiently by | 429 // TODO(beng): This should be handled sufficiently by |
359 // OmniboxImpl::ShowWindow() but unfortunately view manager policy | 430 // OmniboxImpl::ShowWindow() but unfortunately view manager policy |
360 // currently prevents the embedded app from changing window z for | 431 // currently prevents the embedded app from changing window z for |
361 // its own window. | 432 // its own window. |
362 omnibox_view_->MoveToFront(); | 433 omnibox_view_->MoveToFront(); |
363 } | 434 } |
364 | 435 |
365 } // namespace mandoline | 436 } // namespace mandoline |
OLD | NEW |