| 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 #ifndef CHROME_BROWSER_UI_BROWSER_WINDOW_STATE_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_WINDOW_STATE_H_ |
| 6 #define CHROME_BROWSER_UI_BROWSER_WINDOW_STATE_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_WINDOW_STATE_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "components/prefs/scoped_user_pref_update.h" | 11 #include "components/prefs/scoped_user_pref_update.h" |
| 12 #include "ui/base/ui_base_types.h" | 12 #include "ui/base/ui_base_types.h" |
| 13 | 13 |
| 14 class Browser; | 14 class Browser; |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class DictionaryValue; | 17 class DictionaryValue; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace gfx { | 20 namespace gfx { |
| 21 class Rect; | 21 class Rect; |
| 22 } | 22 } |
| 23 | 23 |
| 24 class PrefService; | 24 class PrefService; |
| 25 | 25 |
| 26 namespace chrome { | 26 namespace chrome { |
| 27 | 27 |
| 28 std::string GetWindowName(const Browser* browser); | 28 std::string GetWindowName(const Browser* browser); |
| 29 // A "window placement dictionary" holds information about the size and location | 29 // A "window placement dictionary" holds information about the size and location |
| 30 // of the window that is stored in the given PrefService. If the window_name | 30 // of the window that is stored in the given PrefService. If the window_name |
| 31 // isn't the name of a registered preference it is assumed to be the name of an | 31 // isn't the name of a registered preference it is assumed to be the name of an |
| 32 // app and the AppWindowPlacement key is used to find the app's dictionary. | 32 // app and the AppWindowPlacement key is used to find the app's dictionary. |
| 33 scoped_ptr<DictionaryPrefUpdate> GetWindowPlacementDictionaryReadWrite( | 33 std::unique_ptr<DictionaryPrefUpdate> GetWindowPlacementDictionaryReadWrite( |
| 34 const std::string& window_name, | 34 const std::string& window_name, |
| 35 PrefService* prefs); | 35 PrefService* prefs); |
| 36 // Returns NULL if the window corresponds to an app that doesn't have placement | 36 // Returns NULL if the window corresponds to an app that doesn't have placement |
| 37 // information stored in the preferences system. | 37 // information stored in the preferences system. |
| 38 const base::DictionaryValue* GetWindowPlacementDictionaryReadOnly( | 38 const base::DictionaryValue* GetWindowPlacementDictionaryReadOnly( |
| 39 const std::string& window_name, | 39 const std::string& window_name, |
| 40 PrefService* prefs); | 40 PrefService* prefs); |
| 41 | 41 |
| 42 bool ShouldSaveWindowPlacement(const Browser* browser); | 42 bool ShouldSaveWindowPlacement(const Browser* browser); |
| 43 | 43 |
| 44 // Returns true if the saved bounds for this window should be treated as the | 44 // Returns true if the saved bounds for this window should be treated as the |
| 45 // bounds of the content area, not the whole window. | 45 // bounds of the content area, not the whole window. |
| 46 bool SavedBoundsAreContentBounds(const Browser* browser); | 46 bool SavedBoundsAreContentBounds(const Browser* browser); |
| 47 | 47 |
| 48 void SaveWindowPlacement(const Browser* browser, | 48 void SaveWindowPlacement(const Browser* browser, |
| 49 const gfx::Rect& bounds, | 49 const gfx::Rect& bounds, |
| 50 ui::WindowShowState show_state); | 50 ui::WindowShowState show_state); |
| 51 | 51 |
| 52 // Return the |bounds| for the browser window to be used upon creation. | 52 // Return the |bounds| for the browser window to be used upon creation. |
| 53 // The |show_state| variable will receive the desired initial show state for | 53 // The |show_state| variable will receive the desired initial show state for |
| 54 // the window. | 54 // the window. |
| 55 void GetSavedWindowBoundsAndShowState(const Browser* browser, | 55 void GetSavedWindowBoundsAndShowState(const Browser* browser, |
| 56 gfx::Rect* bounds, | 56 gfx::Rect* bounds, |
| 57 ui::WindowShowState* show_state); | 57 ui::WindowShowState* show_state); |
| 58 | 58 |
| 59 } // namespace chrome | 59 } // namespace chrome |
| 60 | 60 |
| 61 #endif // CHROME_BROWSER_UI_BROWSER_WINDOW_STATE_H_ | 61 #endif // CHROME_BROWSER_UI_BROWSER_WINDOW_STATE_H_ |
| OLD | NEW |