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

Unified Diff: chrome/browser/ui/window_sizer.cc

Issue 5915006: Remove user-related data from local_state and add to user_preferences, i... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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/browser/ui/window_sizer.h ('k') | chrome/common/pref_names.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/window_sizer.cc
===================================================================
--- chrome/browser/ui/window_sizer.cc (revision 73335)
+++ chrome/browser/ui/window_sizer.cc (working copy)
@@ -6,6 +6,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
@@ -16,9 +17,9 @@
// and persistent state from the browser window and the user's profile.
class DefaultStateProvider : public WindowSizer::StateProvider {
public:
- explicit DefaultStateProvider(const std::string& app_name, Browser* browser)
- : app_name_(app_name),
- browser_(browser) {
+ explicit DefaultStateProvider(const std::string& app_name,
+ const Browser* browser) : app_name_(app_name),
+ browser_(browser) {
}
// Overridden from WindowSizer::StateProvider:
@@ -33,11 +34,11 @@
key.append(app_name_);
}
- if (!g_browser_process->local_state())
+ if (!browser_->profile()->GetPrefs())
return false;
const DictionaryValue* wp_pref =
- g_browser_process->local_state()->GetDictionary(key.c_str());
+ browser_->profile()->GetPrefs()->GetDictionary(key.c_str());
int top = 0, left = 0, bottom = 0, right = 0;
bool has_prefs =
wp_pref &&
@@ -74,9 +75,9 @@
// If a reference browser is set, use its window. Otherwise find last
// active.
BrowserWindow* window = NULL;
- if (browser_) {
+ // Window may be null if browser is just starting up.
+ if (browser_ && browser_->window()) {
window = browser_->window();
- DCHECK(window);
} else {
BrowserList::const_reverse_iterator it = BrowserList::begin_last_active();
BrowserList::const_reverse_iterator end = BrowserList::end_last_active();
@@ -102,7 +103,7 @@
std::string app_name_;
// If set, is used as the reference browser for GetLastActiveWindowState.
- Browser* browser_;
+ const Browser* browser_;
DISALLOW_COPY_AND_ASSIGN(DefaultStateProvider);
};
@@ -132,7 +133,7 @@
// static
void WindowSizer::GetBrowserWindowBounds(const std::string& app_name,
const gfx::Rect& specified_bounds,
- Browser* browser,
+ const Browser* browser,
gfx::Rect* window_bounds,
bool* maximized) {
const WindowSizer sizer(new DefaultStateProvider(app_name, browser),
« no previous file with comments | « chrome/browser/ui/window_sizer.h ('k') | chrome/common/pref_names.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698