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

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

Issue 12262019: Replace static/native-desktop-only BrowserList::const_reverse_iterator by desktop specific ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: chrome_launcher_controller_per_app_unittest should be creating browsers on the ash desktop Created 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser_list.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/window_sizer/window_sizer.h" 5 #include "chrome/browser/ui/window_sizer/window_sizer.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/ash/ash_init.h" 12 #include "chrome/browser/ui/ash/ash_init.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_list.h" 14 #include "chrome/browser/ui/browser_list_impl.h"
15 #include "chrome/browser/ui/browser_window.h" 15 #include "chrome/browser/ui/browser_window.h"
16 #include "chrome/browser/ui/browser_window_state.h" 16 #include "chrome/browser/ui/browser_window_state.h"
17 #include "chrome/browser/ui/host_desktop.h"
17 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
19 #include "ui/gfx/screen.h" 20 #include "ui/gfx/screen.h"
20 21
21 // Minimum height of the visible part of a window. 22 // Minimum height of the visible part of a window.
22 const int kMinVisibleHeight = 30; 23 const int kMinVisibleHeight = 30;
23 // Minimum width of the visible part of a window. 24 // Minimum width of the visible part of a window.
24 const int kMinVisibleWidth = 30; 25 const int kMinVisibleWidth = 30;
25 26
26 class DefaultMonitorInfoProvider : public MonitorInfoProvider { 27 class DefaultMonitorInfoProvider : public MonitorInfoProvider {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return false; 106 return false;
106 107
107 // If a reference browser is set, use its window. Otherwise find last 108 // If a reference browser is set, use its window. Otherwise find last
108 // active. Panels are never used as reference browsers as panels are 109 // active. Panels are never used as reference browsers as panels are
109 // specially positioned. 110 // specially positioned.
110 BrowserWindow* window = NULL; 111 BrowserWindow* window = NULL;
111 // Window may be null if browser is just starting up. 112 // Window may be null if browser is just starting up.
112 if (browser_ && browser_->window() && !browser_->window()->IsPanel()) { 113 if (browser_ && browser_->window() && !browser_->window()->IsPanel()) {
113 window = browser_->window(); 114 window = browser_->window();
114 } else { 115 } else {
115 BrowserList::const_reverse_iterator it = BrowserList::begin_last_active(); 116 // This code is only ran on the native desktop (on the ash desktop,
116 BrowserList::const_reverse_iterator end = BrowserList::end_last_active(); 117 // GetBoundsOverrideAsh should take over below before this is reached).
117 for (; (it != end); ++it) { 118 // TODO(gab): This code should go in a native desktop specific window
119 // sizer as part of fixing crbug.com/175812.
120 const chrome::BrowserListImpl* native_browser_list =
121 chrome::BrowserListImpl::GetInstance(
122 chrome::HOST_DESKTOP_TYPE_NATIVE);
123 for (chrome::BrowserListImpl::const_reverse_iterator it =
124 native_browser_list->begin_last_active();
125 it != native_browser_list->end_last_active(); ++it) {
118 Browser* last_active = *it; 126 Browser* last_active = *it;
119 if (last_active && last_active->is_type_tabbed()) { 127 if (last_active && last_active->is_type_tabbed()) {
120 window = last_active->window(); 128 window = last_active->window();
121 DCHECK(window); 129 DCHECK(window);
122 break; 130 break;
123 } 131 }
124 } 132 }
125 } 133 }
126 134
127 if (window) { 135 if (window) {
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 400
393 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) 401 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized))
394 return ui::SHOW_STATE_MAXIMIZED; 402 return ui::SHOW_STATE_MAXIMIZED;
395 403
396 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) 404 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT)
397 return browser_->initial_show_state(); 405 return browser_->initial_show_state();
398 406
399 // Otherwise we use the default which can be overridden later on. 407 // Otherwise we use the default which can be overridden later on.
400 return ui::SHOW_STATE_DEFAULT; 408 return ui::SHOW_STATE_DEFAULT;
401 } 409 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_list.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698