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 "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" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 wp_pref->GetInteger("work_area_top", &work_area_top); | 72 wp_pref->GetInteger("work_area_top", &work_area_top); |
73 wp_pref->GetInteger("work_area_left", &work_area_left); | 73 wp_pref->GetInteger("work_area_left", &work_area_left); |
74 wp_pref->GetInteger("work_area_bottom", &work_area_bottom); | 74 wp_pref->GetInteger("work_area_bottom", &work_area_bottom); |
75 wp_pref->GetInteger("work_area_right", &work_area_right); | 75 wp_pref->GetInteger("work_area_right", &work_area_right); |
76 if (*show_state == ui::SHOW_STATE_DEFAULT && maximized) | 76 if (*show_state == ui::SHOW_STATE_DEFAULT && maximized) |
77 *show_state = ui::SHOW_STATE_MAXIMIZED; | 77 *show_state = ui::SHOW_STATE_MAXIMIZED; |
78 bool docked = false; | 78 bool docked = false; |
79 wp_pref->GetBoolean("docked", &docked); | 79 wp_pref->GetBoolean("docked", &docked); |
80 if (*show_state == ui::SHOW_STATE_DEFAULT && docked && | 80 if (*show_state == ui::SHOW_STATE_DEFAULT && docked && |
81 !browser_->is_type_tabbed() && | 81 !browser_->is_type_tabbed() && |
82 browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) { | 82 browser_->host_desktop_type() == ui::HOST_DESKTOP_TYPE_ASH) { |
83 *show_state = ui::SHOW_STATE_DOCKED; | 83 *show_state = ui::SHOW_STATE_DOCKED; |
84 } | 84 } |
85 } | 85 } |
86 work_area->SetRect(work_area_left, work_area_top, | 86 work_area->SetRect(work_area_left, work_area_top, |
87 std::max(0, work_area_right - work_area_left), | 87 std::max(0, work_area_right - work_area_left), |
88 std::max(0, work_area_bottom - work_area_top)); | 88 std::max(0, work_area_bottom - work_area_top)); |
89 | 89 |
90 return has_prefs; | 90 return has_prefs; |
91 } | 91 } |
92 | 92 |
(...skipping 12 matching lines...) Expand all Loading... |
105 // Window may be null if browser is just starting up. | 105 // Window may be null if browser is just starting up. |
106 if (browser_ && browser_->window()) { | 106 if (browser_ && browser_->window()) { |
107 window = browser_->window(); | 107 window = browser_->window(); |
108 } else { | 108 } else { |
109 // This code is only ran on the native desktop (on the ash | 109 // This code is only ran on the native desktop (on the ash |
110 // desktop, GetTabbedBrowserBoundsAsh should take over below | 110 // desktop, GetTabbedBrowserBoundsAsh should take over below |
111 // before this is reached). TODO(gab): This code should go in a | 111 // before this is reached). TODO(gab): This code should go in a |
112 // native desktop specific window sizer as part of fixing | 112 // native desktop specific window sizer as part of fixing |
113 // crbug.com/175812. | 113 // crbug.com/175812. |
114 const BrowserList* native_browser_list = | 114 const BrowserList* native_browser_list = |
115 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE); | 115 BrowserList::GetInstance(ui::HOST_DESKTOP_TYPE_NATIVE); |
116 for (BrowserList::const_reverse_iterator it = | 116 for (BrowserList::const_reverse_iterator it = |
117 native_browser_list->begin_last_active(); | 117 native_browser_list->begin_last_active(); |
118 it != native_browser_list->end_last_active(); ++it) { | 118 it != native_browser_list->end_last_active(); ++it) { |
119 Browser* last_active = *it; | 119 Browser* last_active = *it; |
120 if (last_active && last_active->is_type_tabbed()) { | 120 if (last_active && last_active->is_type_tabbed()) { |
121 window = last_active->window(); | 121 window = last_active->window(); |
122 DCHECK(window); | 122 DCHECK(window); |
123 break; | 123 break; |
124 } | 124 } |
125 } | 125 } |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 442 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
443 switches::kStartMaximized)) | 443 switches::kStartMaximized)) |
444 return ui::SHOW_STATE_MAXIMIZED; | 444 return ui::SHOW_STATE_MAXIMIZED; |
445 | 445 |
446 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) | 446 if (browser_->initial_show_state() != ui::SHOW_STATE_DEFAULT) |
447 return browser_->initial_show_state(); | 447 return browser_->initial_show_state(); |
448 | 448 |
449 // Otherwise we use the default which can be overridden later on. | 449 // Otherwise we use the default which can be overridden later on. |
450 return ui::SHOW_STATE_DEFAULT; | 450 return ui::SHOW_STATE_DEFAULT; |
451 } | 451 } |
OLD | NEW |