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

Side by Side Diff: chrome/browser/ui/window_sizer/window_sizer.cc

Issue 511393003: No longer register app window placement preference keys on the fly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make member variables local Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 virtual bool GetPersistentState( 44 virtual bool GetPersistentState(
45 gfx::Rect* bounds, 45 gfx::Rect* bounds,
46 gfx::Rect* work_area, 46 gfx::Rect* work_area,
47 ui::WindowShowState* show_state) const OVERRIDE { 47 ui::WindowShowState* show_state) const OVERRIDE {
48 DCHECK(bounds); 48 DCHECK(bounds);
49 DCHECK(show_state); 49 DCHECK(show_state);
50 50
51 if (!browser_ || !browser_->profile()->GetPrefs()) 51 if (!browser_ || !browser_->profile()->GetPrefs())
52 return false; 52 return false;
53 53
54 std::string window_name(chrome::GetWindowPlacementKey(browser_));
55 const base::DictionaryValue* wp_pref = 54 const base::DictionaryValue* wp_pref =
56 browser_->profile()->GetPrefs()->GetDictionary(window_name.c_str()); 55 chrome::GetWindowPlacementDictionaryReadOnly(browser_);
57 int top = 0, left = 0, bottom = 0, right = 0; 56 int top = 0, left = 0, bottom = 0, right = 0;
58 bool maximized = false; 57 bool maximized = false;
59 bool has_prefs = wp_pref && 58 bool has_prefs = wp_pref &&
60 wp_pref->GetInteger("top", &top) && 59 wp_pref->GetInteger("top", &top) &&
61 wp_pref->GetInteger("left", &left) && 60 wp_pref->GetInteger("left", &left) &&
62 wp_pref->GetInteger("bottom", &bottom) && 61 wp_pref->GetInteger("bottom", &bottom) &&
63 wp_pref->GetInteger("right", &right) && 62 wp_pref->GetInteger("right", &right) &&
64 wp_pref->GetBoolean("maximized", &maximized); 63 wp_pref->GetBoolean("maximized", &maximized);
65 bounds->SetRect(left, top, std::max(0, right - left), 64 bounds->SetRect(left, top, std::max(0, right - left),
66 std::max(0, bottom - top)); 65 std::max(0, bottom - top));
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 434
436 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) 435 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized))
437 return ui::SHOW_STATE_MAXIMIZED; 436 return ui::SHOW_STATE_MAXIMIZED;
438 437
439 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) 438 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT)
440 return browser_->initial_show_state(); 439 return browser_->initial_show_state();
441 440
442 // Otherwise we use the default which can be overridden later on. 441 // Otherwise we use the default which can be overridden later on.
443 return ui::SHOW_STATE_DEFAULT; 442 return ui::SHOW_STATE_DEFAULT;
444 } 443 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698