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/window_sizer/window_sizer.h" | 5 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 return false; | 103 return false; |
104 | 104 |
105 // If a reference browser is set, use its window. Otherwise find last | 105 // If a reference browser is set, use its window. Otherwise find last |
106 // active. Panels are never used as reference browsers as panels are | 106 // active. Panels are never used as reference browsers as panels are |
107 // specially positioned. | 107 // specially positioned. |
108 BrowserWindow* window = NULL; | 108 BrowserWindow* window = NULL; |
109 // Window may be null if browser is just starting up. | 109 // Window may be null if browser is just starting up. |
110 if (browser_ && browser_->window()) { | 110 if (browser_ && browser_->window()) { |
111 window = browser_->window(); | 111 window = browser_->window(); |
112 } else { | 112 } else { |
113 // This code is only ran on the native desktop (on the ash | 113 // This code is only run on the native desktop (on the ash |
114 // desktop, GetTabbedBrowserBoundsAsh should take over below | 114 // desktop, GetTabbedBrowserBoundsAsh should take over below |
115 // before this is reached). TODO(gab): This code should go in a | 115 // before this is reached). TODO(gab): This code should go in a |
116 // native desktop specific window sizer as part of fixing | 116 // native desktop specific window sizer as part of fixing |
117 // crbug.com/175812. | 117 // crbug.com/175812. |
118 const BrowserList* native_browser_list = | 118 const BrowserList* browser_list = BrowserList::GetInstance(); |
119 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE); | |
120 for (BrowserList::const_reverse_iterator it = | 119 for (BrowserList::const_reverse_iterator it = |
121 native_browser_list->begin_last_active(); | 120 browser_list->begin_last_active(); |
122 it != native_browser_list->end_last_active(); ++it) { | 121 it != browser_list->end_last_active(); ++it) { |
123 Browser* last_active = *it; | 122 Browser* last_active = *it; |
124 if (last_active && last_active->is_type_tabbed()) { | 123 if (last_active && last_active->is_type_tabbed()) { |
125 window = last_active->window(); | 124 window = last_active->window(); |
126 DCHECK(window); | 125 DCHECK(window); |
127 break; | 126 break; |
128 } | 127 } |
129 } | 128 } |
130 } | 129 } |
131 | 130 |
132 if (window) { | 131 if (window) { |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 442 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
444 switches::kStartMaximized)) | 443 switches::kStartMaximized)) |
445 return ui::SHOW_STATE_MAXIMIZED; | 444 return ui::SHOW_STATE_MAXIMIZED; |
446 | 445 |
447 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) | 446 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) |
448 return browser_->initial_show_state(); | 447 return browser_->initial_show_state(); |
449 | 448 |
450 // Otherwise we use the default which can be overridden later on. | 449 // Otherwise we use the default which can be overridden later on. |
451 return ui::SHOW_STATE_DEFAULT; | 450 return ui::SHOW_STATE_DEFAULT; |
452 } | 451 } |
OLD | NEW |