| OLD | NEW |
| 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/window_sizer/window_sizer.h" | 5 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 virtual bool GetPersistentState( | 45 virtual bool GetPersistentState( |
| 46 gfx::Rect* bounds, | 46 gfx::Rect* bounds, |
| 47 gfx::Rect* work_area, | 47 gfx::Rect* work_area, |
| 48 ui::WindowShowState* show_state) const OVERRIDE { | 48 ui::WindowShowState* show_state) const OVERRIDE { |
| 49 DCHECK(bounds); | 49 DCHECK(bounds); |
| 50 DCHECK(show_state); | 50 DCHECK(show_state); |
| 51 | 51 |
| 52 if (!browser_ || !browser_->profile()->GetPrefs()) | 52 if (!browser_ || !browser_->profile()->GetPrefs()) |
| 53 return false; | 53 return false; |
| 54 | 54 |
| 55 std::string window_name(chrome::GetWindowPlacementKey(browser_)); | |
| 56 const base::DictionaryValue* wp_pref = | 55 const base::DictionaryValue* wp_pref = |
| 57 browser_->profile()->GetPrefs()->GetDictionary(window_name.c_str()); | 56 chrome::GetWindowPlacementDictionaryReadOnly( |
| 57 chrome::GetWindowName(browser_), browser_->profile()->GetPrefs()); |
| 58 int top = 0, left = 0, bottom = 0, right = 0; | 58 int top = 0, left = 0, bottom = 0, right = 0; |
| 59 bool maximized = false; | 59 bool maximized = false; |
| 60 bool has_prefs = wp_pref && | 60 bool has_prefs = wp_pref && |
| 61 wp_pref->GetInteger("top", &top) && | 61 wp_pref->GetInteger("top", &top) && |
| 62 wp_pref->GetInteger("left", &left) && | 62 wp_pref->GetInteger("left", &left) && |
| 63 wp_pref->GetInteger("bottom", &bottom) && | 63 wp_pref->GetInteger("bottom", &bottom) && |
| 64 wp_pref->GetInteger("right", &right) && | 64 wp_pref->GetInteger("right", &right) && |
| 65 wp_pref->GetBoolean("maximized", &maximized); | 65 wp_pref->GetBoolean("maximized", &maximized); |
| 66 bounds->SetRect(left, top, std::max(0, right - left), | 66 bounds->SetRect(left, top, std::max(0, right - left), |
| 67 std::max(0, bottom - top)); | 67 std::max(0, bottom - top)); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 436 |
| 437 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) | 437 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) |
| 438 return ui::SHOW_STATE_MAXIMIZED; | 438 return ui::SHOW_STATE_MAXIMIZED; |
| 439 | 439 |
| 440 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) | 440 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) |
| 441 return browser_->initial_show_state(); | 441 return browser_->initial_show_state(); |
| 442 | 442 |
| 443 // Otherwise we use the default which can be overridden later on. | 443 // Otherwise we use the default which can be overridden later on. |
| 444 return ui::SHOW_STATE_DEFAULT; | 444 return ui::SHOW_STATE_DEFAULT; |
| 445 } | 445 } |
| OLD | NEW |