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" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 root_->AddChild(content_); | 202 root_->AddChild(content_); |
203 host_->AddActivationParent(root_->id()); | 203 host_->AddActivationParent(root_->id()); |
204 content_->SetVisible(true); | 204 content_->SetVisible(true); |
205 | 205 |
206 web_view_.Init(app_, content_); | 206 web_view_.Init(app_, content_); |
207 | 207 |
208 host_->AddAccelerator( | 208 host_->AddAccelerator( |
209 static_cast<uint32_t>(BrowserCommand::CLOSE), | 209 static_cast<uint32_t>(BrowserCommand::CLOSE), |
210 mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_W, | 210 mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_W, |
211 mus::mojom::EVENT_FLAGS_CONTROL_DOWN)); | 211 mus::mojom::EVENT_FLAGS_CONTROL_DOWN), |
| 212 mus::mojom::WindowTreeHost::AddAcceleratorCallback()); |
212 host_->AddAccelerator( | 213 host_->AddAccelerator( |
213 static_cast<uint32_t>(BrowserCommand::FOCUS_OMNIBOX), | 214 static_cast<uint32_t>(BrowserCommand::FOCUS_OMNIBOX), |
214 mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_L, | 215 mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_L, |
215 mus::mojom::EVENT_FLAGS_CONTROL_DOWN)); | 216 mus::mojom::EVENT_FLAGS_CONTROL_DOWN), |
| 217 mus::mojom::WindowTreeHost::AddAcceleratorCallback()); |
216 host_->AddAccelerator( | 218 host_->AddAccelerator( |
217 static_cast<uint32_t>(BrowserCommand::NEW_WINDOW), | 219 static_cast<uint32_t>(BrowserCommand::NEW_WINDOW), |
218 mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_N, | 220 mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_N, |
219 mus::mojom::EVENT_FLAGS_CONTROL_DOWN)); | 221 mus::mojom::EVENT_FLAGS_CONTROL_DOWN), |
| 222 mus::mojom::WindowTreeHost::AddAcceleratorCallback()); |
220 host_->AddAccelerator( | 223 host_->AddAccelerator( |
221 static_cast<uint32_t>(BrowserCommand::SHOW_FIND), | 224 static_cast<uint32_t>(BrowserCommand::SHOW_FIND), |
222 mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_F, | 225 mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_F, |
223 mus::mojom::EVENT_FLAGS_CONTROL_DOWN)); | 226 mus::mojom::EVENT_FLAGS_CONTROL_DOWN), |
224 host_->AddAccelerator( | 227 mus::mojom::WindowTreeHost::AddAcceleratorCallback()); |
225 static_cast<uint32_t>(BrowserCommand::GO_BACK), | 228 host_->AddAccelerator(static_cast<uint32_t>(BrowserCommand::GO_BACK), |
226 mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_LEFT, | 229 mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_LEFT, |
227 mus::mojom::EVENT_FLAGS_ALT_DOWN)); | 230 mus::mojom::EVENT_FLAGS_ALT_DOWN), |
228 host_->AddAccelerator( | 231 mus::mojom::WindowTreeHost::AddAcceleratorCallback()); |
229 static_cast<uint32_t>(BrowserCommand::GO_FORWARD), | 232 host_->AddAccelerator(static_cast<uint32_t>(BrowserCommand::GO_FORWARD), |
230 mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_RIGHT, | 233 mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_RIGHT, |
231 mus::mojom::EVENT_FLAGS_ALT_DOWN)); | 234 mus::mojom::EVENT_FLAGS_ALT_DOWN), |
| 235 mus::mojom::WindowTreeHost::AddAcceleratorCallback()); |
232 // Now that we're ready, load the default url. | 236 // Now that we're ready, load the default url. |
233 LoadURL(default_url_); | 237 LoadURL(default_url_); |
234 | 238 |
235 // Record the time spent opening initial tabs, used for performance testing. | 239 // Record the time spent opening initial tabs, used for performance testing. |
236 const base::TimeDelta open_tabs_delta = | 240 const base::TimeDelta open_tabs_delta = |
237 base::TimeTicks::Now() - display_ticks; | 241 base::TimeTicks::Now() - display_ticks; |
238 | 242 |
239 // Record the browser startup time metrics, used for performance testing. | 243 // Record the browser startup time metrics, used for performance testing. |
240 static bool recorded_browser_startup_metrics = false; | 244 static bool recorded_browser_startup_metrics = false; |
241 if (!recorded_browser_startup_metrics && | 245 if (!recorded_browser_startup_metrics && |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 content_bounds.set_width(DIPSToPixels(progress_bar_bounds.width())); | 446 content_bounds.set_width(DIPSToPixels(progress_bar_bounds.width())); |
443 content_bounds.set_height(host->bounds().height() - content_bounds.y() - | 447 content_bounds.set_height(host->bounds().height() - content_bounds.y() - |
444 DIPSToPixels(10)); | 448 DIPSToPixels(10)); |
445 content_->SetBounds(content_bounds); | 449 content_->SetBounds(content_bounds); |
446 | 450 |
447 // The omnibox view bounds are in physical pixels. | 451 // The omnibox view bounds are in physical pixels. |
448 omnibox_view_->SetBounds(bounds_in_physical_pixels); | 452 omnibox_view_->SetBounds(bounds_in_physical_pixels); |
449 } | 453 } |
450 | 454 |
451 } // namespace mandoline | 455 } // namespace mandoline |
OLD | NEW |