| Index: chrome/browser/ui/views/chrome_views_delegate.cc
|
| diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc
|
| index a471e6f06e4cdacd996f65c2b3f529b8bc624013..e198f84547c275a066f191e7709c70c750e1ab7e 100644
|
| --- a/chrome/browser/ui/views/chrome_views_delegate.cc
|
| +++ b/chrome/browser/ui/views/chrome_views_delegate.cc
|
| @@ -8,6 +8,7 @@
|
| #include "base/string_util.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "chrome/browser/browser_process.h"
|
| +#include "chrome/browser/browser_shutdown.h"
|
| #include "chrome/browser/prefs/pref_service.h"
|
| #include "chrome/browser/prefs/scoped_user_pref_update.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| @@ -32,13 +33,16 @@ namespace {
|
| // been initialized.
|
| // TODO(mirandac): This function will also separate windows by profile in a
|
| // multi-profile environment.
|
| -PrefService* GetPrefsForWindow(const views::Widget* window) {
|
| +PrefService* GetPrefsForWindow(const views::Widget* window,
|
| + bool* using_local_state) {
|
| Profile* profile = reinterpret_cast<Profile*>(
|
| window->GetNativeWindowProperty(Profile::kProfileKey));
|
| if (!profile) {
|
| // Use local state for windows that have no explicit profile.
|
| + *using_local_state = true;
|
| return g_browser_process->local_state();
|
| }
|
| + *using_local_state = false;
|
| return profile->GetPrefs();
|
| }
|
|
|
| @@ -62,11 +66,14 @@ void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window,
|
| const std::wstring& window_name,
|
| const gfx::Rect& bounds,
|
| bool maximized) {
|
| - PrefService* prefs = GetPrefsForWindow(window);
|
| + bool using_local_state = false;
|
| + PrefService* prefs = GetPrefsForWindow(window, &using_local_state);
|
| if (!prefs)
|
| return;
|
|
|
| - DCHECK(prefs->FindPreference(WideToUTF8(window_name).c_str()));
|
| + CHECK(prefs->FindPreference(WideToUTF8(window_name).c_str())) << " " <<
|
| + browser_shutdown::GetShutdownType() << " " << using_local_state << " " <<
|
| + window->destroy_state();
|
| DictionaryPrefUpdate update(prefs, WideToUTF8(window_name).c_str());
|
| DictionaryValue* window_preferences = update.Get();
|
| window_preferences->SetInteger("left", bounds.x());
|
|
|