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

Side by Side Diff: chrome/browser/ui/browser_tab_restore_service_delegate.cc

Issue 10692195: Consolidate Browser Creation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser/ui/browser_tab_restore_service_delegate.h" 5 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h"
6 6
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_commands.h" 8 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/browser/ui/browser_finder.h" 9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/browser_tabrestore.h" 10 #include "chrome/browser/ui/browser_tabrestore.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 // Implementations of TabRestoreServiceDelegate static methods 82 // Implementations of TabRestoreServiceDelegate static methods
83 83
84 // static 84 // static
85 TabRestoreServiceDelegate* TabRestoreServiceDelegate::Create( 85 TabRestoreServiceDelegate* TabRestoreServiceDelegate::Create(
86 Profile* profile, 86 Profile* profile,
87 const std::string& app_name) { 87 const std::string& app_name) {
88 Browser* browser; 88 Browser* browser;
89 if (app_name.empty()) { 89 if (app_name.empty()) {
90 browser = Browser::Create(profile); 90 browser = new Browser(Browser::CreateParams(profile));
91 } else { 91 } else {
92 browser = Browser::CreateWithParams( 92 browser = new Browser(
93 Browser::CreateParams::CreateForApp( 93 Browser::CreateParams::CreateForApp(
94 Browser::TYPE_POPUP, app_name, gfx::Rect(), profile)); 94 Browser::TYPE_POPUP, app_name, gfx::Rect(), profile));
95 } 95 }
96 if (browser) 96 if (browser)
97 return browser->tab_restore_service_delegate(); 97 return browser->tab_restore_service_delegate();
98 else 98 else
99 return NULL; 99 return NULL;
100 } 100 }
101 101
102 // static 102 // static
103 TabRestoreServiceDelegate* 103 TabRestoreServiceDelegate*
104 TabRestoreServiceDelegate::FindDelegateForWebContents( 104 TabRestoreServiceDelegate::FindDelegateForWebContents(
105 const WebContents* contents) { 105 const WebContents* contents) {
106 Browser* browser = browser::FindBrowserWithWebContents(contents); 106 Browser* browser = browser::FindBrowserWithWebContents(contents);
107 return browser ? browser->tab_restore_service_delegate() : NULL; 107 return browser ? browser->tab_restore_service_delegate() : NULL;
108 } 108 }
109 109
110 // static 110 // static
111 TabRestoreServiceDelegate* TabRestoreServiceDelegate::FindDelegateWithID( 111 TabRestoreServiceDelegate* TabRestoreServiceDelegate::FindDelegateWithID(
112 SessionID::id_type desired_id) { 112 SessionID::id_type desired_id) {
113 Browser* browser = browser::FindBrowserWithID(desired_id); 113 Browser* browser = browser::FindBrowserWithID(desired_id);
114 return browser ? browser->tab_restore_service_delegate() : NULL; 114 return browser ? browser->tab_restore_service_delegate() : NULL;
115 } 115 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_navigator_browsertest.cc ('k') | chrome/browser/ui/browser_tab_strip_model_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698