Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4103)

Unified Diff: chrome/test/base/test_browser_window.cc

Issue 1198313003: Fix the browser match rules. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address sky@'s comment. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/base/test_browser_window.h ('k') | chrome/test/base/test_browser_window_aura.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/test_browser_window.cc
diff --git a/chrome/test/base/test_browser_window.cc b/chrome/test/base/test_browser_window.cc
index 8bfc54c0b946c7117030471a426adce64233eb70..e3cf6c8c5c983233f7d23e9fba666fa694fc40a2 100644
--- a/chrome/test/base/test_browser_window.cc
+++ b/chrome/test/base/test_browser_window.cc
@@ -13,36 +13,12 @@
namespace chrome {
-namespace {
-
-// Handles destroying a TestBrowserWindow when the Browser it is attached to is
-// destroyed.
-class TestBrowserWindowOwner : public chrome::BrowserListObserver {
- public:
- explicit TestBrowserWindowOwner(TestBrowserWindow* window) : window_(window) {
- BrowserList::AddObserver(this);
- }
- ~TestBrowserWindowOwner() override { BrowserList::RemoveObserver(this); }
-
- private:
- // Overridden from BrowserListObserver:
- void OnBrowserRemoved(Browser* browser) override {
- if (browser->window() == window_.get())
- delete this;
- }
-
- scoped_ptr<TestBrowserWindow> window_;
-
- DISALLOW_COPY_AND_ASSIGN(TestBrowserWindowOwner);
-};
-
-} // namespace
-
-Browser* CreateBrowserWithTestWindowForParams(Browser::CreateParams* params) {
+scoped_ptr<Browser> CreateBrowserWithTestWindowForParams(
+ Browser::CreateParams* params) {
TestBrowserWindow* window = new TestBrowserWindow;
new TestBrowserWindowOwner(window);
params->window = window;
- return new Browser(*params);
+ return make_scoped_ptr(new Browser(*params));
}
} // namespace chrome
@@ -219,8 +195,7 @@ web_modal::WebContentsModalDialogHost*
return NULL;
}
-int
-TestBrowserWindow::GetRenderViewHeightInsetWithDetachedBookmarkBar() {
+int TestBrowserWindow::GetRenderViewHeightInsetWithDetachedBookmarkBar() {
return 0;
}
@@ -231,3 +206,19 @@ void TestBrowserWindow::ExecuteExtensionCommand(
ExclusiveAccessContext* TestBrowserWindow::GetExclusiveAccessContext() {
return nullptr;
}
+
+// TestBrowserWindowOwner -----------------------------------------------------
+
+TestBrowserWindowOwner::TestBrowserWindowOwner(TestBrowserWindow* window)
+ : window_(window) {
+ BrowserList::AddObserver(this);
+}
+
+TestBrowserWindowOwner::~TestBrowserWindowOwner() {
+ BrowserList::RemoveObserver(this);
+}
+
+void TestBrowserWindowOwner::OnBrowserRemoved(Browser* browser) {
+ if (browser->window() == window_.get())
+ delete this;
+}
« no previous file with comments | « chrome/test/base/test_browser_window.h ('k') | chrome/test/base/test_browser_window_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698