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/browser_window_state.h" | 5 #include "chrome/browser/ui/browser_window_state.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 prefs::kBrowserWindowPlacementPopup : prefs::kBrowserWindowPlacement; | 78 prefs::kBrowserWindowPlacementPopup : prefs::kBrowserWindowPlacement; |
79 } | 79 } |
80 return browser->app_name(); | 80 return browser->app_name(); |
81 } | 81 } |
82 | 82 |
83 std::unique_ptr<DictionaryPrefUpdate> GetWindowPlacementDictionaryReadWrite( | 83 std::unique_ptr<DictionaryPrefUpdate> GetWindowPlacementDictionaryReadWrite( |
84 const std::string& window_name, | 84 const std::string& window_name, |
85 PrefService* prefs) { | 85 PrefService* prefs) { |
86 DCHECK(!window_name.empty()); | 86 DCHECK(!window_name.empty()); |
87 // A normal DictionaryPrefUpdate will suffice for non-app windows. | 87 // A normal DictionaryPrefUpdate will suffice for non-app windows. |
88 if (prefs->FindPreference(window_name.c_str())) { | 88 if (prefs->FindPreference(window_name)) { |
89 return base::MakeUnique<DictionaryPrefUpdate>(prefs, window_name.c_str()); | 89 return base::MakeUnique<DictionaryPrefUpdate>(prefs, window_name); |
90 } | 90 } |
91 return std::unique_ptr<DictionaryPrefUpdate>( | 91 return std::unique_ptr<DictionaryPrefUpdate>( |
92 new WindowPlacementPrefUpdate(prefs, window_name)); | 92 new WindowPlacementPrefUpdate(prefs, window_name)); |
93 } | 93 } |
94 | 94 |
95 const base::DictionaryValue* GetWindowPlacementDictionaryReadOnly( | 95 const base::DictionaryValue* GetWindowPlacementDictionaryReadOnly( |
96 const std::string& window_name, | 96 const std::string& window_name, |
97 PrefService* prefs) { | 97 PrefService* prefs) { |
98 DCHECK(!window_name.empty()); | 98 DCHECK(!window_name.empty()); |
99 if (prefs->FindPreference(window_name.c_str())) | 99 if (prefs->FindPreference(window_name)) |
100 return prefs->GetDictionary(window_name.c_str()); | 100 return prefs->GetDictionary(window_name); |
101 | 101 |
102 const base::DictionaryValue* app_windows = | 102 const base::DictionaryValue* app_windows = |
103 prefs->GetDictionary(prefs::kAppWindowPlacement); | 103 prefs->GetDictionary(prefs::kAppWindowPlacement); |
104 if (!app_windows) | 104 if (!app_windows) |
105 return NULL; | 105 return NULL; |
106 const base::DictionaryValue* to_return = NULL; | 106 const base::DictionaryValue* to_return = NULL; |
107 app_windows->GetDictionary(window_name, &to_return); | 107 app_windows->GetDictionary(window_name, &to_return); |
108 return to_return; | 108 return to_return; |
109 } | 109 } |
110 | 110 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { | 168 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { |
169 std::string str = | 169 std::string str = |
170 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); | 170 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); |
171 int x, y; | 171 int x, y; |
172 if (ParseCommaSeparatedIntegers(str, &x, &y)) | 172 if (ParseCommaSeparatedIntegers(str, &x, &y)) |
173 bounds->set_origin(gfx::Point(x, y)); | 173 bounds->set_origin(gfx::Point(x, y)); |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 } // namespace chrome | 177 } // namespace chrome |
OLD | NEW |