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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 name.append(browser->app_name()); | 48 name.append(browser->app_name()); |
49 } | 49 } |
50 return name; | 50 return name; |
51 } | 51 } |
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 the window belongs to |
59 // or the window belongs to DevTools or an App. | 59 // DevTools or an App. |
60 return browser_defaults::kRestorePopups || browser->is_devtools() || | 60 return browser->is_devtools() || browser->is_app(); |
61 browser->is_app(); | |
62 default: | 61 default: |
63 return false; | 62 return false; |
64 } | 63 } |
65 } | 64 } |
66 | 65 |
67 void SaveWindowPlacement(const Browser* browser, | 66 void SaveWindowPlacement(const Browser* browser, |
68 const gfx::Rect& bounds, | 67 const gfx::Rect& bounds, |
69 ui::WindowShowState show_state) { | 68 ui::WindowShowState show_state) { |
70 // Save to the session storage service, used when reloading a past session. | 69 // Save to the session storage service, used when reloading a past session. |
71 // Note that we don't want to be the ones who cause lazy initialization of | 70 // 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... |
113 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { | 112 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { |
114 std::string str = | 113 std::string str = |
115 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); | 114 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); |
116 int x, y; | 115 int x, y; |
117 if (ParseCommaSeparatedIntegers(str, &x, &y)) | 116 if (ParseCommaSeparatedIntegers(str, &x, &y)) |
118 bounds->set_origin(gfx::Point(x, y)); | 117 bounds->set_origin(gfx::Point(x, y)); |
119 } | 118 } |
120 } | 119 } |
121 | 120 |
122 } // namespace chrome | 121 } // namespace chrome |
OLD | NEW |