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/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 <memory> |
| 8 |
8 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/lifetime/keep_alive_types.h" | 14 #include "chrome/browser/lifetime/keep_alive_types.h" |
14 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 15 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/browser/ui/browser_window_state.h" | 17 #include "chrome/browser/ui/browser_window_state.h" |
17 #include "components/prefs/pref_service.h" | 18 #include "components/prefs/pref_service.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 188 } |
188 | 189 |
189 void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window, | 190 void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window, |
190 const std::string& window_name, | 191 const std::string& window_name, |
191 const gfx::Rect& bounds, | 192 const gfx::Rect& bounds, |
192 ui::WindowShowState show_state) { | 193 ui::WindowShowState show_state) { |
193 PrefService* prefs = GetPrefsForWindow(window); | 194 PrefService* prefs = GetPrefsForWindow(window); |
194 if (!prefs) | 195 if (!prefs) |
195 return; | 196 return; |
196 | 197 |
197 scoped_ptr<DictionaryPrefUpdate> pref_update = | 198 std::unique_ptr<DictionaryPrefUpdate> pref_update = |
198 chrome::GetWindowPlacementDictionaryReadWrite(window_name, prefs); | 199 chrome::GetWindowPlacementDictionaryReadWrite(window_name, prefs); |
199 base::DictionaryValue* window_preferences = pref_update->Get(); | 200 base::DictionaryValue* window_preferences = pref_update->Get(); |
200 window_preferences->SetInteger("left", bounds.x()); | 201 window_preferences->SetInteger("left", bounds.x()); |
201 window_preferences->SetInteger("top", bounds.y()); | 202 window_preferences->SetInteger("top", bounds.y()); |
202 window_preferences->SetInteger("right", bounds.right()); | 203 window_preferences->SetInteger("right", bounds.right()); |
203 window_preferences->SetInteger("bottom", bounds.bottom()); | 204 window_preferences->SetInteger("bottom", bounds.bottom()); |
204 window_preferences->SetBoolean("maximized", | 205 window_preferences->SetBoolean("maximized", |
205 show_state == ui::SHOW_STATE_MAXIMIZED); | 206 show_state == ui::SHOW_STATE_MAXIMIZED); |
206 window_preferences->SetBoolean("docked", show_state == ui::SHOW_STATE_DOCKED); | 207 window_preferences->SetBoolean("docked", show_state == ui::SHOW_STATE_DOCKED); |
207 gfx::Rect work_area(gfx::Screen::GetScreen() | 208 gfx::Rect work_area(gfx::Screen::GetScreen() |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 return content::BrowserThread::GetBlockingPool(); | 488 return content::BrowserThread::GetBlockingPool(); |
488 } | 489 } |
489 | 490 |
490 #if !defined(USE_ASH) | 491 #if !defined(USE_ASH) |
491 views::Widget::InitParams::WindowOpacity | 492 views::Widget::InitParams::WindowOpacity |
492 ChromeViewsDelegate::GetOpacityForInitParams( | 493 ChromeViewsDelegate::GetOpacityForInitParams( |
493 const views::Widget::InitParams& params) { | 494 const views::Widget::InitParams& params) { |
494 return views::Widget::InitParams::OPAQUE_WINDOW; | 495 return views::Widget::InitParams::OPAQUE_WINDOW; |
495 } | 496 } |
496 #endif | 497 #endif |
OLD | NEW |