Chromium Code Reviews| 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 "chrome/browser/ui/browser_list.h" | 7 #include "chrome/browser/ui/browser_list.h" |
| 8 #include "chrome/browser/ui/browser_list_observer.h" | 8 #include "chrome/browser/ui/browser_list_observer.h" |
| 9 #include "ui/aura/window.h" | |
| 9 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| 10 | 11 |
| 11 | |
| 12 // Helpers -------------------------------------------------------------------- | 12 // Helpers -------------------------------------------------------------------- |
| 13 | 13 |
| 14 namespace chrome { | 14 namespace chrome { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // Handles destroying a TestBrowserWindow when the Browser it is attached to is | 18 // Handles destroying a TestBrowserWindow when the Browser it is attached to is |
| 19 // destroyed. | 19 // destroyed. |
| 20 class TestBrowserWindowOwner : public chrome::BrowserListObserver { | 20 class TestBrowserWindowOwner : public chrome::BrowserListObserver { |
| 21 public: | 21 public: |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 return 0; | 224 return 0; |
| 225 } | 225 } |
| 226 | 226 |
| 227 void TestBrowserWindow::ExecuteExtensionCommand( | 227 void TestBrowserWindow::ExecuteExtensionCommand( |
| 228 const extensions::Extension* extension, | 228 const extensions::Extension* extension, |
| 229 const extensions::Command& command) {} | 229 const extensions::Command& command) {} |
| 230 | 230 |
| 231 ExclusiveAccessContext* TestBrowserWindow::GetExclusiveAccessContext() { | 231 ExclusiveAccessContext* TestBrowserWindow::GetExclusiveAccessContext() { |
| 232 return nullptr; | 232 return nullptr; |
| 233 } | 233 } |
| 234 | |
| 235 #if defined(USE_AURA) | |
| 236 | |
| 237 // TestBrowserWindowAura ------------------------------------------------------- | |
| 238 | |
| 239 TestBrowserWindowAura::TestBrowserWindowAura(aura::Window* native_window) | |
| 240 : native_window_(native_window) { | |
| 241 } | |
| 242 | |
| 243 TestBrowserWindowAura::~TestBrowserWindowAura() { | |
| 244 } | |
| 245 | |
| 246 gfx::NativeWindow TestBrowserWindowAura::GetNativeWindow() const { | |
| 247 return native_window_.get(); | |
| 248 } | |
| 249 | |
| 250 void TestBrowserWindowAura::Show() { | |
| 251 native_window_->Show(); | |
| 252 } | |
| 253 | |
| 254 void TestBrowserWindowAura::Hide() { | |
| 255 native_window_->Hide(); | |
| 256 } | |
| 257 | |
| 258 gfx::Rect TestBrowserWindowAura::GetBounds() const { | |
| 259 return native_window_->bounds(); | |
| 260 } | |
| 261 | |
| 262 Browser* TestBrowserWindowAura::browser() { | |
| 263 return browser_.get(); | |
| 264 } | |
| 265 | |
| 266 void TestBrowserWindowAura::CreateBrowser(const Browser::CreateParams& params) { | |
| 267 Browser::CreateParams create_params = params; | |
| 268 create_params.window = this; | |
| 269 browser_.reset(new Browser(create_params)); | |
| 270 } | |
| 271 | |
| 272 scoped_ptr<TestBrowserWindowAura> CreateBrowserWithNativeWindowForParams( | |
| 273 const Browser::CreateParams& params) { | |
| 274 // Create a window. | |
|
msw
2015/07/07 18:11:55
nit: remove comment.
xdai1
2015/07/08 00:26:21
Done.
| |
| 275 aura::Window* window = new aura::Window(nullptr); | |
| 276 window->set_id(0); | |
| 277 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | |
| 278 window->Init(ui::LAYER_TEXTURED); | |
| 279 window->Show(); | |
| 280 | |
| 281 scoped_ptr<TestBrowserWindowAura> browser_window( | |
| 282 new TestBrowserWindowAura(window)); | |
| 283 browser_window->CreateBrowser(params); | |
| 284 return browser_window.Pass(); | |
| 285 } | |
| 286 | |
| 287 #endif | |
| OLD | NEW |