| Index: chrome/browser/ui/window_sizer.cc
|
| diff --git a/chrome/browser/ui/window_sizer.cc b/chrome/browser/ui/window_sizer.cc
|
| index bcd321caf64d6f9d003ff310a905007a465cb21f..9a8d7f35419740a25135485266f50a3ba93667cb 100644
|
| --- a/chrome/browser/ui/window_sizer.cc
|
| +++ b/chrome/browser/ui/window_sizer.cc
|
| @@ -23,29 +23,21 @@ class DefaultStateProvider : public WindowSizer::StateProvider {
|
|
|
| // Overridden from WindowSizer::StateProvider:
|
| virtual bool GetPersistentState(gfx::Rect* bounds,
|
| - bool* maximized,
|
| gfx::Rect* work_area) const {
|
| - DCHECK(bounds && maximized);
|
| -
|
| - std::string key(prefs::kBrowserWindowPlacement);
|
| - if (!app_name_.empty()) {
|
| - key.append("_");
|
| - key.append(app_name_);
|
| - }
|
| + DCHECK(bounds);
|
|
|
| if (!browser_ || !browser_->profile()->GetPrefs())
|
| return false;
|
|
|
| + std::string window_name(browser_->GetWindowPlacementKey());
|
| const DictionaryValue* wp_pref =
|
| - browser_->profile()->GetPrefs()->GetDictionary(key.c_str());
|
| + browser_->profile()->GetPrefs()->GetDictionary(window_name.c_str());
|
| int top = 0, left = 0, bottom = 0, right = 0;
|
| - bool has_prefs =
|
| - wp_pref &&
|
| - wp_pref->GetInteger("top", &top) &&
|
| - wp_pref->GetInteger("left", &left) &&
|
| - wp_pref->GetInteger("bottom", &bottom) &&
|
| - wp_pref->GetInteger("right", &right) &&
|
| - wp_pref->GetBoolean("maximized", maximized);
|
| + bool has_prefs = wp_pref &&
|
| + wp_pref->GetInteger("top", &top) &&
|
| + wp_pref->GetInteger("left", &left) &&
|
| + wp_pref->GetInteger("bottom", &bottom) &&
|
| + wp_pref->GetInteger("right", &right);
|
| bounds->SetRect(left, top, std::max(0, right - left),
|
| std::max(0, bottom - top));
|
|
|
| @@ -128,24 +120,22 @@ WindowSizer::~WindowSizer() {
|
| void WindowSizer::GetBrowserWindowBounds(const std::string& app_name,
|
| const gfx::Rect& specified_bounds,
|
| const Browser* browser,
|
| - gfx::Rect* window_bounds,
|
| - bool* maximized) {
|
| + gfx::Rect* window_bounds) {
|
| const WindowSizer sizer(new DefaultStateProvider(app_name, browser),
|
| CreateDefaultMonitorInfoProvider());
|
| - sizer.DetermineWindowBounds(specified_bounds, window_bounds, maximized);
|
| + sizer.DetermineWindowBounds(specified_bounds, window_bounds);
|
| }
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| // WindowSizer, private:
|
|
|
| void WindowSizer::DetermineWindowBounds(const gfx::Rect& specified_bounds,
|
| - gfx::Rect* bounds,
|
| - bool* maximized) const {
|
| + gfx::Rect* bounds) const {
|
| *bounds = specified_bounds;
|
| if (bounds->IsEmpty()) {
|
| // See if there's saved placement information.
|
| if (!GetLastWindowBounds(bounds)) {
|
| - if (!GetSavedWindowBounds(bounds, maximized)) {
|
| + if (!GetSavedWindowBounds(bounds)) {
|
| // No saved placement, figure out some sensible default size based on
|
| // the user's screen size.
|
| GetDefaultWindowBounds(bounds);
|
| @@ -166,12 +156,11 @@ bool WindowSizer::GetLastWindowBounds(gfx::Rect* bounds) const {
|
| return true;
|
| }
|
|
|
| -bool WindowSizer::GetSavedWindowBounds(gfx::Rect* bounds,
|
| - bool* maximized) const {
|
| - DCHECK(bounds && maximized);
|
| +bool WindowSizer::GetSavedWindowBounds(gfx::Rect* bounds) const {
|
| + DCHECK(bounds);
|
| gfx::Rect saved_work_area;
|
| if (!state_provider_ ||
|
| - !state_provider_->GetPersistentState(bounds, maximized, &saved_work_area))
|
| + !state_provider_->GetPersistentState(bounds, &saved_work_area))
|
| return false;
|
| AdjustBoundsToBeVisibleOnMonitorContaining(*bounds, saved_work_area, bounds);
|
| return true;
|
|
|