OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/importing_progress_view.h" | 5 #include "chrome/browser/views/importing_progress_view.h" |
6 | 6 |
7 #include "chrome/app/locales/locale_settings.h" | 7 #include "chrome/app/locales/locale_settings.h" |
8 #include "chrome/browser/views/standard_layout.h" | 8 #include "chrome/browser/views/standard_layout.h" |
9 #include "chrome/common/l10n_util.h" | 9 #include "chrome/common/l10n_util.h" |
10 #include "chrome/views/grid_layout.h" | 10 #include "chrome/views/grid_layout.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 importing_ = false; | 144 importing_ = false; |
145 coordinator_->SetObserver(NULL); | 145 coordinator_->SetObserver(NULL); |
146 window()->Close(); | 146 window()->Close(); |
147 if (import_observer_) | 147 if (import_observer_) |
148 import_observer_->ImportComplete(); | 148 import_observer_->ImportComplete(); |
149 } | 149 } |
150 | 150 |
151 //////////////////////////////////////////////////////////////////////////////// | 151 //////////////////////////////////////////////////////////////////////////////// |
152 // ImportingProgressView, ChromeViews::View overrides: | 152 // ImportingProgressView, ChromeViews::View overrides: |
153 | 153 |
154 void ImportingProgressView::GetPreferredSize(CSize* out) { | 154 gfx::Size ImportingProgressView::GetPreferredSize() { |
155 DCHECK(out); | 155 return gfx::Size(ChromeViews::Window::GetLocalizedContentsSize( |
156 *out = ChromeViews::Window::GetLocalizedContentsSize( | |
157 IDS_IMPORTPROGRESS_DIALOG_WIDTH_CHARS, | 156 IDS_IMPORTPROGRESS_DIALOG_WIDTH_CHARS, |
158 IDS_IMPORTPROGRESS_DIALOG_HEIGHT_LINES).ToSIZE(); | 157 IDS_IMPORTPROGRESS_DIALOG_HEIGHT_LINES)); |
159 } | 158 } |
160 | 159 |
161 void ImportingProgressView::ViewHierarchyChanged(bool is_add, | 160 void ImportingProgressView::ViewHierarchyChanged(bool is_add, |
162 ChromeViews::View* parent, | 161 ChromeViews::View* parent, |
163 ChromeViews::View* child) { | 162 ChromeViews::View* child) { |
164 if (is_add && child == this) | 163 if (is_add && child == this) |
165 InitControlLayout(); | 164 InitControlLayout(); |
166 } | 165 } |
167 | 166 |
168 //////////////////////////////////////////////////////////////////////////////// | 167 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 //////////////////////////////////////////////////////////////////////////////// | 206 //////////////////////////////////////////////////////////////////////////////// |
208 // ImportingProgressView, private: | 207 // ImportingProgressView, private: |
209 | 208 |
210 void ImportingProgressView::InitControlLayout() { | 209 void ImportingProgressView::InitControlLayout() { |
211 using ChromeViews::GridLayout; | 210 using ChromeViews::GridLayout; |
212 using ChromeViews::ColumnSet; | 211 using ChromeViews::ColumnSet; |
213 | 212 |
214 GridLayout* layout = CreatePanelGridLayout(this); | 213 GridLayout* layout = CreatePanelGridLayout(this); |
215 SetLayoutManager(layout); | 214 SetLayoutManager(layout); |
216 | 215 |
217 CSize ps; | 216 gfx::Size ps = state_history_->GetPreferredSize(); |
218 state_history_->GetPreferredSize(&ps); | |
219 | 217 |
220 const int single_column_view_set_id = 0; | 218 const int single_column_view_set_id = 0; |
221 ColumnSet* column_set = layout->AddColumnSet(single_column_view_set_id); | 219 ColumnSet* column_set = layout->AddColumnSet(single_column_view_set_id); |
222 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 220 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
223 GridLayout::USE_PREF, 0, 0); | 221 GridLayout::USE_PREF, 0, 0); |
224 const int double_column_view_set_id = 1; | 222 const int double_column_view_set_id = 1; |
225 column_set = layout->AddColumnSet(double_column_view_set_id); | 223 column_set = layout->AddColumnSet(double_column_view_set_id); |
226 column_set->AddPaddingColumn(0, kUnrelatedControlLargeHorizontalSpacing); | 224 column_set->AddPaddingColumn(0, kUnrelatedControlLargeHorizontalSpacing); |
227 column_set->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0, | 225 column_set->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0, |
228 GridLayout::FIXED, ps.cx, 0); | 226 GridLayout::FIXED, ps.width(), 0); |
229 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); | 227 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); |
230 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 1, | 228 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 1, |
231 GridLayout::USE_PREF, 0, 0); | 229 GridLayout::USE_PREF, 0, 0); |
232 column_set->AddPaddingColumn(0, kUnrelatedControlLargeHorizontalSpacing); | 230 column_set->AddPaddingColumn(0, kUnrelatedControlLargeHorizontalSpacing); |
233 | 231 |
234 layout->StartRow(0, single_column_view_set_id); | 232 layout->StartRow(0, single_column_view_set_id); |
235 layout->AddView(label_info_); | 233 layout->AddView(label_info_); |
236 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); | 234 layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing); |
237 | 235 |
238 if (items_ & FAVORITES) { | 236 if (items_ & FAVORITES) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 DCHECK(items != 0); | 278 DCHECK(items != 0); |
281 ImportingProgressView* v = new ImportingProgressView( | 279 ImportingProgressView* v = new ImportingProgressView( |
282 source_profile.description, items, coordinator, observer, parent_window); | 280 source_profile.description, items, coordinator, observer, parent_window); |
283 ChromeViews::Window::CreateChromeWindow(parent_window, gfx::Rect(), | 281 ChromeViews::Window::CreateChromeWindow(parent_window, gfx::Rect(), |
284 v)->Show(); | 282 v)->Show(); |
285 coordinator->StartImportSettings(source_profile, items, | 283 coordinator->StartImportSettings(source_profile, items, |
286 new ProfileWriter(target_profile), | 284 new ProfileWriter(target_profile), |
287 first_run); | 285 first_run); |
288 } | 286 } |
289 | 287 |
OLD | NEW |