| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/test/base/test_browser_window.h" | 5 #include "chrome/test/base/test_browser_window.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/ui/browser_list.h" | 8 #include "chrome/browser/ui/browser_list.h" |
| 9 #include "chrome/browser/ui/browser_list_observer.h" | 9 #include "chrome/browser/ui/browser_list_observer.h" |
| 10 #include "content/public/browser/keyboard_event_processing_result.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 11 #include "ui/gfx/geometry/rect.h" |
| 11 | 12 |
| 12 | |
| 13 // Helpers -------------------------------------------------------------------- | 13 // Helpers -------------------------------------------------------------------- |
| 14 | 14 |
| 15 namespace chrome { | 15 namespace chrome { |
| 16 | 16 |
| 17 std::unique_ptr<Browser> CreateBrowserWithTestWindowForParams( | 17 std::unique_ptr<Browser> CreateBrowserWithTestWindowForParams( |
| 18 Browser::CreateParams* params) { | 18 Browser::CreateParams* params) { |
| 19 TestBrowserWindow* window = new TestBrowserWindow; | 19 TestBrowserWindow* window = new TestBrowserWindow; |
| 20 new TestBrowserWindowOwner(window); | 20 new TestBrowserWindowOwner(window); |
| 21 params->window = window; | 21 params->window = window; |
| 22 return base::MakeUnique<Browser>(*params); | 22 return base::MakeUnique<Browser>(*params); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 114 } |
| 115 | 115 |
| 116 LocationBar* TestBrowserWindow::GetLocationBar() const { | 116 LocationBar* TestBrowserWindow::GetLocationBar() const { |
| 117 return const_cast<TestLocationBar*>(&location_bar_); | 117 return const_cast<TestLocationBar*>(&location_bar_); |
| 118 } | 118 } |
| 119 | 119 |
| 120 ToolbarActionsBar* TestBrowserWindow::GetToolbarActionsBar() { | 120 ToolbarActionsBar* TestBrowserWindow::GetToolbarActionsBar() { |
| 121 return nullptr; | 121 return nullptr; |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool TestBrowserWindow::PreHandleKeyboardEvent( | 124 content::KeyboardEventProcessingResult |
| 125 const content::NativeWebKeyboardEvent& event, | 125 TestBrowserWindow::PreHandleKeyboardEvent( |
| 126 bool* is_keyboard_shortcut) { | 126 const content::NativeWebKeyboardEvent& event) { |
| 127 return false; | 127 return content::KeyboardEventProcessingResult::NOT_HANDLED; |
| 128 } | 128 } |
| 129 | 129 |
| 130 bool TestBrowserWindow::IsBookmarkBarVisible() const { | 130 bool TestBrowserWindow::IsBookmarkBarVisible() const { |
| 131 return false; | 131 return false; |
| 132 } | 132 } |
| 133 | 133 |
| 134 bool TestBrowserWindow::IsBookmarkBarAnimating() const { | 134 bool TestBrowserWindow::IsBookmarkBarAnimating() const { |
| 135 return false; | 135 return false; |
| 136 } | 136 } |
| 137 | 137 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 | 209 |
| 210 TestBrowserWindowOwner::~TestBrowserWindowOwner() { | 210 TestBrowserWindowOwner::~TestBrowserWindowOwner() { |
| 211 BrowserList::RemoveObserver(this); | 211 BrowserList::RemoveObserver(this); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void TestBrowserWindowOwner::OnBrowserRemoved(Browser* browser) { | 214 void TestBrowserWindowOwner::OnBrowserRemoved(Browser* browser) { |
| 215 if (browser->window() == window_.get()) | 215 if (browser->window() == window_.get()) |
| 216 delete this; | 216 delete this; |
| 217 } | 217 } |
| OLD | NEW |