Chromium Code Reviews| Index: chrome/browser/ui/browser.cc | 
| diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc | 
| index d3c5569cb47a8a198a99ef5e1ceb8164d7e89787..3981805f91435ecc118f12a78dbd65d342e45f2a 100644 | 
| --- a/chrome/browser/ui/browser.cc | 
| +++ b/chrome/browser/ui/browser.cc | 
| @@ -321,7 +321,9 @@ bool ParseCommaSeparatedIntegers(const std::string& str, | 
| Browser::CreateParams::CreateParams(Type type, Profile* profile) | 
| : type(type), | 
| - profile(profile) { | 
| + profile(profile), | 
| + initial_show_state(ui::SHOW_STATE_DEFAULT), | 
| + is_session_restore(false) { | 
| } | 
| /////////////////////////////////////////////////////////////////////////////// | 
| @@ -486,9 +488,15 @@ Browser* Browser::Create(Profile* profile) { | 
| // static | 
| Browser* Browser::CreateWithParams(const CreateParams& params) { | 
| + if (!params.app_name.empty()) | 
| + RegisterAppPrefs(params.app_name, params.profile); | 
| + | 
| Browser* browser = new Browser(params.type, params.profile); | 
| browser->app_name_ = params.app_name; | 
| browser->set_override_bounds(params.initial_bounds); | 
| + browser->set_show_state(params.initial_show_state); | 
| + browser->set_is_session_restore(params.is_session_restore); | 
| + | 
| browser->InitBrowserWindow(); | 
| return browser; | 
| } | 
| @@ -507,8 +515,6 @@ Browser* Browser::CreateForApp(Type type, | 
| DCHECK(type != TYPE_TABBED); | 
| DCHECK(!app_name.empty()); | 
| - RegisterAppPrefs(app_name, profile); | 
| - | 
| #if !defined(OS_CHROMEOS) || defined(USE_AURA) | 
| if (type == TYPE_PANEL && | 
| !PanelManager::ShouldUsePanels( | 
| @@ -978,6 +984,10 @@ bool Browser::ShouldSaveWindowPlacement() const { | 
| case TYPE_POPUP: | 
| // Only save the window placement of popups if they are restored, | 
| // or the window belongs to DevTools. | 
| +#if defined USE_AURA | 
| + if (is_app()) | 
| + return true; | 
| +#endif | 
| return browser_defaults::kRestorePopups || is_devtools(); | 
| case TYPE_PANEL: | 
| // Do not save the window placement of panels. | 
| @@ -1037,7 +1047,14 @@ gfx::Rect Browser::GetSavedWindowBounds() const { | 
| ui::WindowShowState Browser::GetSavedWindowShowState() const { | 
| // Only tabbed browsers use the command line or preference state. | 
| - if (!is_type_tabbed()) | 
| + bool return_show_state = !is_type_tabbed(); | 
| 
 
sky
2012/02/24 20:56:04
nit: how about just show_state. Initially when I s
 
DaveMoore
2012/02/25 16:54:42
Done.
 
 | 
| + | 
| +#if defined(USE_AURA) | 
| + // Apps save state on aura. | 
| + return_show_state &= !is_app(); | 
| +#endif | 
| + | 
| + if (return_show_state) | 
| return show_state_; | 
| if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) | 
| @@ -1154,6 +1171,12 @@ void Browser::OnWindowClosing() { | 
| TabRestoreService* tab_restore_service = | 
| TabRestoreServiceFactory::GetForProfile(profile()); | 
| + | 
| +#if defined(USE_AURA) | 
| + if (tab_restore_service && is_app()) | 
| 
 
sky
2012/02/24 20:56:04
Move this into it's own method with the ifdef so t
 
 | 
| + tab_restore_service->BrowserClosing(tab_restore_service_delegate()); | 
| +#endif | 
| + | 
| if (tab_restore_service && is_type_tabbed() && tab_count()) | 
| tab_restore_service->BrowserClosing(tab_restore_service_delegate()); |