| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/views/first_run_search_engine_view.h" | 5 #include "chrome/browser/ui/views/first_run_search_engine_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 template_url_service_->SetSearchEngineDialogSlot(choice->slot()); | 176 template_url_service_->SetSearchEngineDialogSlot(choice->slot()); |
| 177 const TemplateURL* default_search = choice->GetSearchEngine(); | 177 const TemplateURL* default_search = choice->GetSearchEngine(); |
| 178 if (default_search) | 178 if (default_search) |
| 179 template_url_service_->SetDefaultSearchProvider(default_search); | 179 template_url_service_->SetDefaultSearchProvider(default_search); |
| 180 | 180 |
| 181 MessageLoop::current()->Quit(); | 181 MessageLoop::current()->Quit(); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void FirstRunSearchEngineView::OnPaint(gfx::Canvas* canvas) { | 184 void FirstRunSearchEngineView::OnPaint(gfx::Canvas* canvas) { |
| 185 // Fill in behind the background image with the standard gray toolbar color. | 185 // Fill in behind the background image with the standard gray toolbar color. |
| 186 canvas->FillRectInt(GetThemeProvider()->GetColor(ThemeService::COLOR_TOOLBAR), | 186 canvas->FillRect(GetThemeProvider()->GetColor(ThemeService::COLOR_TOOLBAR), |
| 187 0, 0, width(), background_image_->height()); | 187 gfx::Rect(0, 0, width(), background_image_->height())); |
| 188 // The rest of the dialog background should be white. | 188 // The rest of the dialog background should be white. |
| 189 DCHECK(height() > background_image_->height()); | 189 DCHECK(height() > background_image_->height()); |
| 190 canvas->FillRectInt(SK_ColorWHITE, 0, background_image_->height(), width(), | 190 canvas->FillRect(SK_ColorWHITE, |
| 191 height() - background_image_->height()); | 191 gfx::Rect(0, background_image_->height(), width(), |
| 192 height() - background_image_->height())); |
| 192 } | 193 } |
| 193 | 194 |
| 194 void FirstRunSearchEngineView::OnTemplateURLServiceChanged() { | 195 void FirstRunSearchEngineView::OnTemplateURLServiceChanged() { |
| 195 // We only watch the search engine model change once, on load. Remove | 196 // We only watch the search engine model change once, on load. Remove |
| 196 // observer so we don't try to redraw if engines change under us. | 197 // observer so we don't try to redraw if engines change under us. |
| 197 template_url_service_->RemoveObserver(this); | 198 template_url_service_->RemoveObserver(this); |
| 198 | 199 |
| 199 template_url_service_loaded_ = true; | 200 template_url_service_loaded_ = true; |
| 200 AddSearchEnginesIfPossible(); | 201 AddSearchEnginesIfPossible(); |
| 201 } | 202 } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 (*it)->SetText((*it)->GetSearchEngine()->short_name()); | 463 (*it)->SetText((*it)->GetSearchEngine()->short_name()); |
| 463 } | 464 } |
| 464 } | 465 } |
| 465 | 466 |
| 466 // This will tell screenreaders that they should read the full text | 467 // This will tell screenreaders that they should read the full text |
| 467 // of this dialog to the user now (rather than waiting for the user | 468 // of this dialog to the user now (rather than waiting for the user |
| 468 // to explore it). | 469 // to explore it). |
| 469 GetWidget()->NotifyAccessibilityEvent( | 470 GetWidget()->NotifyAccessibilityEvent( |
| 470 this, ui::AccessibilityTypes::EVENT_ALERT, true); | 471 this, ui::AccessibilityTypes::EVENT_ALERT, true); |
| 471 } | 472 } |
| OLD | NEW |