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

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

Issue 944433002: Revamp the MigrateBrowserPrefs and MigrateUserPrefs code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gab comments Created 5 years, 10 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
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/browser_window_state.h" 5 #include "chrome/browser/ui/browser_window_state.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.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_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 private: 63 private:
64 const std::string window_name_; 64 const std::string window_name_;
65 65
66 DISALLOW_COPY_AND_ASSIGN(WindowPlacementPrefUpdate); 66 DISALLOW_COPY_AND_ASSIGN(WindowPlacementPrefUpdate);
67 }; 67 };
68 68
69 } // namespace 69 } // namespace
70 70
71 std::string GetWindowName(const Browser* browser) { 71 std::string GetWindowName(const Browser* browser) {
72 if (browser->app_name().empty()) { 72 if (browser->app_name().empty()) {
73 return browser->is_type_popup() ? 73 return prefs::kBrowserWindowPlacementPopup;
rkaplow 2015/02/20 21:58:08 I'm not too sure about this. Can someone with cont
74 prefs::kBrowserWindowPlacementPopup : prefs::kBrowserWindowPlacement;
75 } 74 }
76 return browser->app_name(); 75 return browser->app_name();
77 } 76 }
78 77
79 scoped_ptr<DictionaryPrefUpdate> GetWindowPlacementDictionaryReadWrite( 78 scoped_ptr<DictionaryPrefUpdate> GetWindowPlacementDictionaryReadWrite(
80 const std::string& window_name, 79 const std::string& window_name,
81 PrefService* prefs) { 80 PrefService* prefs) {
82 DCHECK(!window_name.empty()); 81 DCHECK(!window_name.empty());
83 // A normal DictionaryPrefUpdate will suffice for non-app windows. 82 // A normal DictionaryPrefUpdate will suffice for non-app windows.
84 if (prefs->FindPreference(window_name.c_str())) { 83 if (prefs->FindPreference(window_name.c_str())) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { 161 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) {
163 std::string str = 162 std::string str =
164 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); 163 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition);
165 int x, y; 164 int x, y;
166 if (ParseCommaSeparatedIntegers(str, &x, &y)) 165 if (ParseCommaSeparatedIntegers(str, &x, &y))
167 bounds->set_origin(gfx::Point(x, y)); 166 bounds->set_origin(gfx::Point(x, y));
168 } 167 }
169 } 168 }
170 169
171 } // namespace chrome 170 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698