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

Side by Side Diff: chrome/browser/ui/views/chrome_views_delegate.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: update to ToT 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/views/chrome_views_delegate.h" 5 #include "chrome/browser/ui/views/chrome_views_delegate.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/prefs/scoped_user_pref_update.h" 9 #include "base/prefs/scoped_user_pref_update.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/browser/ui/browser_window_state.h"
15 #include "chrome/browser/ui/views/accessibility/accessibility_event_router_views .h" 16 #include "chrome/browser/ui/views/accessibility/accessibility_event_router_views .h"
16 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
17 #include "grit/chrome_unscaled_resources.h" 18 #include "grit/chrome_unscaled_resources.h"
18 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
19 #include "ui/base/ui_base_switches.h" 20 #include "ui/base/ui_base_switches.h"
20 #include "ui/gfx/rect.h" 21 #include "ui/gfx/rect.h"
21 #include "ui/gfx/screen.h" 22 #include "ui/gfx/screen.h"
22 #include "ui/views/widget/native_widget.h" 23 #include "ui/views/widget/native_widget.h"
23 #include "ui/views/widget/widget.h" 24 #include "ui/views/widget/widget.h"
24 25
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 137 }
137 138
138 void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window, 139 void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window,
139 const std::string& window_name, 140 const std::string& window_name,
140 const gfx::Rect& bounds, 141 const gfx::Rect& bounds,
141 ui::WindowShowState show_state) { 142 ui::WindowShowState show_state) {
142 PrefService* prefs = GetPrefsForWindow(window); 143 PrefService* prefs = GetPrefsForWindow(window);
143 if (!prefs) 144 if (!prefs)
144 return; 145 return;
145 146
146 DCHECK(prefs->FindPreference(window_name.c_str())); 147 scoped_ptr<DictionaryPrefUpdate> pref_update =
147 DictionaryPrefUpdate update(prefs, window_name.c_str()); 148 chrome::GetWindowPlacementDictionaryReadWrite(window_name, prefs);
148 base::DictionaryValue* window_preferences = update.Get(); 149 base::DictionaryValue* window_preferences = pref_update->Get();
149 window_preferences->SetInteger("left", bounds.x()); 150 window_preferences->SetInteger("left", bounds.x());
150 window_preferences->SetInteger("top", bounds.y()); 151 window_preferences->SetInteger("top", bounds.y());
151 window_preferences->SetInteger("right", bounds.right()); 152 window_preferences->SetInteger("right", bounds.right());
152 window_preferences->SetInteger("bottom", bounds.bottom()); 153 window_preferences->SetInteger("bottom", bounds.bottom());
153 window_preferences->SetBoolean("maximized", 154 window_preferences->SetBoolean("maximized",
154 show_state == ui::SHOW_STATE_MAXIMIZED); 155 show_state == ui::SHOW_STATE_MAXIMIZED);
155 gfx::Rect work_area(gfx::Screen::GetScreenFor(window->GetNativeView())-> 156 gfx::Rect work_area(gfx::Screen::GetScreenFor(window->GetNativeView())->
156 GetDisplayNearestWindow(window->GetNativeView()).work_area()); 157 GetDisplayNearestWindow(window->GetNativeView()).work_area());
157 window_preferences->SetInteger("work_area_left", work_area.x()); 158 window_preferences->SetInteger("work_area_left", work_area.x());
158 window_preferences->SetInteger("work_area_top", work_area.y()); 159 window_preferences->SetInteger("work_area_top", work_area.y());
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } 429 }
429 #endif 430 #endif
430 431
431 #if !defined(USE_AURA) && !defined(USE_CHROMEOS) 432 #if !defined(USE_AURA) && !defined(USE_CHROMEOS)
432 views::Widget::InitParams::WindowOpacity 433 views::Widget::InitParams::WindowOpacity
433 ChromeViewsDelegate::GetOpacityForInitParams( 434 ChromeViewsDelegate::GetOpacityForInitParams(
434 const views::Widget::InitParams& params) { 435 const views::Widget::InitParams& params) {
435 return views::Widget::InitParams::OPAQUE_WINDOW; 436 return views::Widget::InitParams::OPAQUE_WINDOW;
436 } 437 }
437 #endif 438 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_private.mm ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698