| 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 <utility> | |
| 10 | |
| 11 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 12 #include "base/macros.h" | 10 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 14 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 15 #include "chrome/browser/defaults.h" | 13 #include "chrome/browser/defaults.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/sessions/session_service.h" | 15 #include "chrome/browser/sessions/session_service.h" |
| 18 #include "chrome/browser/sessions/session_service_factory.h" | 16 #include "chrome/browser/sessions/session_service_factory.h" |
| 19 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 18 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 51 public: | 49 public: |
| 52 WindowPlacementPrefUpdate(PrefService* service, | 50 WindowPlacementPrefUpdate(PrefService* service, |
| 53 const std::string& window_name) | 51 const std::string& window_name) |
| 54 : DictionaryPrefUpdate(service, prefs::kAppWindowPlacement), | 52 : DictionaryPrefUpdate(service, prefs::kAppWindowPlacement), |
| 55 window_name_(window_name) {} | 53 window_name_(window_name) {} |
| 56 | 54 |
| 57 ~WindowPlacementPrefUpdate() override {} | 55 ~WindowPlacementPrefUpdate() override {} |
| 58 | 56 |
| 59 base::DictionaryValue* Get() override { | 57 base::DictionaryValue* Get() override { |
| 60 base::DictionaryValue* all_apps_dict = DictionaryPrefUpdate::Get(); | 58 base::DictionaryValue* all_apps_dict = DictionaryPrefUpdate::Get(); |
| 61 base::DictionaryValue* this_app_dict_weak = NULL; | 59 base::DictionaryValue* this_app_dict = NULL; |
| 62 if (!all_apps_dict->GetDictionary(window_name_, &this_app_dict_weak)) { | 60 if (!all_apps_dict->GetDictionary(window_name_, &this_app_dict)) { |
| 63 auto this_app_dict = base::MakeUnique<base::DictionaryValue>(); | 61 this_app_dict = new base::DictionaryValue; |
| 64 this_app_dict_weak = this_app_dict.get(); | 62 all_apps_dict->Set(window_name_, this_app_dict); |
| 65 all_apps_dict->Set(window_name_, std::move(this_app_dict)); | |
| 66 } | 63 } |
| 67 return this_app_dict_weak; | 64 return this_app_dict; |
| 68 } | 65 } |
| 69 | 66 |
| 70 private: | 67 private: |
| 71 const std::string window_name_; | 68 const std::string window_name_; |
| 72 | 69 |
| 73 DISALLOW_COPY_AND_ASSIGN(WindowPlacementPrefUpdate); | 70 DISALLOW_COPY_AND_ASSIGN(WindowPlacementPrefUpdate); |
| 74 }; | 71 }; |
| 75 | 72 |
| 76 } // namespace | 73 } // namespace |
| 77 | 74 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { | 168 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { |
| 172 std::string str = | 169 std::string str = |
| 173 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); | 170 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); |
| 174 int x, y; | 171 int x, y; |
| 175 if (ParseCommaSeparatedIntegers(str, &x, &y)) | 172 if (ParseCommaSeparatedIntegers(str, &x, &y)) |
| 176 bounds->set_origin(gfx::Point(x, y)); | 173 bounds->set_origin(gfx::Point(x, y)); |
| 177 } | 174 } |
| 178 } | 175 } |
| 179 | 176 |
| 180 } // namespace chrome | 177 } // namespace chrome |
| OLD | NEW |