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/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
10 | 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: |
22 explicit TestBrowserWindowOwner(TestBrowserWindow* window) : window_(window) { | 22 explicit TestBrowserWindowOwner(TestBrowserWindow* window) : window_(window) { |
23 BrowserList::AddObserver(this); | 23 BrowserList::AddObserver(this); |
24 } | 24 } |
25 virtual ~TestBrowserWindowOwner() { | 25 ~TestBrowserWindowOwner() override { BrowserList::RemoveObserver(this); } |
26 BrowserList::RemoveObserver(this); | |
27 } | |
28 | 26 |
29 private: | 27 private: |
30 // Overridden from BrowserListObserver: | 28 // Overridden from BrowserListObserver: |
31 virtual void OnBrowserRemoved(Browser* browser) override { | 29 void OnBrowserRemoved(Browser* browser) override { |
32 if (browser->window() == window_.get()) | 30 if (browser->window() == window_.get()) |
33 delete this; | 31 delete this; |
34 } | 32 } |
35 | 33 |
36 scoped_ptr<TestBrowserWindow> window_; | 34 scoped_ptr<TestBrowserWindow> window_; |
37 | 35 |
38 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindowOwner); | 36 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindowOwner); |
39 }; | 37 }; |
40 | 38 |
41 } // namespace | 39 } // namespace |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 } | 214 } |
217 | 215 |
218 int | 216 int |
219 TestBrowserWindow::GetRenderViewHeightInsetWithDetachedBookmarkBar() { | 217 TestBrowserWindow::GetRenderViewHeightInsetWithDetachedBookmarkBar() { |
220 return 0; | 218 return 0; |
221 } | 219 } |
222 | 220 |
223 void TestBrowserWindow::ExecuteExtensionCommand( | 221 void TestBrowserWindow::ExecuteExtensionCommand( |
224 const extensions::Extension* extension, | 222 const extensions::Extension* extension, |
225 const extensions::Command& command) {} | 223 const extensions::Command& command) {} |
OLD | NEW |