| 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 "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/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "chrome/browser/defaults.h" | 10 #include "chrome/browser/defaults.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 bool ShouldSaveWindowPlacement(const Browser* browser) { | 53 bool ShouldSaveWindowPlacement(const Browser* browser) { |
| 54 switch (browser->type()) { | 54 switch (browser->type()) { |
| 55 case Browser::TYPE_TABBED: | 55 case Browser::TYPE_TABBED: |
| 56 return true; | 56 return true; |
| 57 case Browser::TYPE_POPUP: | 57 case Browser::TYPE_POPUP: |
| 58 // Only save the window placement of popups if they are restored, | 58 // Only save the window placement of popups if they are restored, |
| 59 // or the window belongs to DevTools or an App. | 59 // or the window belongs to DevTools or an App. |
| 60 return browser_defaults::kRestorePopups || browser->is_devtools() || | 60 return browser_defaults::kRestorePopups || browser->is_devtools() || |
| 61 browser->is_app(); | 61 browser->is_app(); |
| 62 case Browser::TYPE_PANEL: | |
| 63 // Do not save the window placement of panels. | |
| 64 return false; | |
| 65 default: | 62 default: |
| 66 return false; | 63 return false; |
| 67 } | 64 } |
| 68 } | 65 } |
| 69 | 66 |
| 70 void SaveWindowPlacement(const Browser* browser, | 67 void SaveWindowPlacement(const Browser* browser, |
| 71 const gfx::Rect& bounds, | 68 const gfx::Rect& bounds, |
| 72 ui::WindowShowState show_state) { | 69 ui::WindowShowState show_state) { |
| 73 // Save to the session storage service, used when reloading a past session. | 70 // Save to the session storage service, used when reloading a past session. |
| 74 // Note that we don't want to be the ones who cause lazy initialization of | 71 // Note that we don't want to be the ones who cause lazy initialization of |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { | 113 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { |
| 117 std::string str = | 114 std::string str = |
| 118 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); | 115 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); |
| 119 int x, y; | 116 int x, y; |
| 120 if (ParseCommaSeparatedIntegers(str, &x, &y)) | 117 if (ParseCommaSeparatedIntegers(str, &x, &y)) |
| 121 bounds->set_origin(gfx::Point(x, y)); | 118 bounds->set_origin(gfx::Point(x, y)); |
| 122 } | 119 } |
| 123 } | 120 } |
| 124 | 121 |
| 125 } // namespace chrome | 122 } // namespace chrome |
| OLD | NEW |