| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/profiles/profile_chooser_view.h" | 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 32 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
| 35 #include "chrome/grit/chromium_strings.h" | 35 #include "chrome/grit/chromium_strings.h" |
| 36 #include "chrome/grit/generated_resources.h" | 36 #include "chrome/grit/generated_resources.h" |
| 37 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" | 37 #include "components/signin/core/browser/mutable_profile_oauth2_token_service.h" |
| 38 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 38 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 39 #include "components/signin/core/browser/signin_error_controller.h" | 39 #include "components/signin/core/browser/signin_error_controller.h" |
| 40 #include "components/signin/core/browser/signin_manager.h" | 40 #include "components/signin/core/browser/signin_manager.h" |
| 41 #include "components/signin/core/common/profile_management_switches.h" | 41 #include "components/signin/core/common/profile_management_switches.h" |
| 42 #include "content/public/browser/render_widget_host_view.h" |
| 42 #include "grit/theme_resources.h" | 43 #include "grit/theme_resources.h" |
| 43 #include "third_party/skia/include/core/SkColor.h" | 44 #include "third_party/skia/include/core/SkColor.h" |
| 44 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
| 45 #include "ui/base/resource/resource_bundle.h" | 46 #include "ui/base/resource/resource_bundle.h" |
| 46 #include "ui/gfx/canvas.h" | 47 #include "ui/gfx/canvas.h" |
| 47 #include "ui/gfx/image/image.h" | 48 #include "ui/gfx/image/image.h" |
| 48 #include "ui/gfx/image/image_skia.h" | 49 #include "ui/gfx/image/image_skia.h" |
| 49 #include "ui/gfx/path.h" | 50 #include "ui/gfx/path.h" |
| 50 #include "ui/gfx/skia_util.h" | 51 #include "ui/gfx/skia_util.h" |
| 51 #include "ui/gfx/text_elider.h" | 52 #include "ui/gfx/text_elider.h" |
| (...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1446 NOTREACHED() << "Called with invalid mode=" << view_mode_; | 1447 NOTREACHED() << "Called with invalid mode=" << view_mode_; |
| 1447 return NULL; | 1448 return NULL; |
| 1448 } | 1449 } |
| 1449 | 1450 |
| 1450 // Adds Gaia signin webview | 1451 // Adds Gaia signin webview |
| 1451 Profile* profile = browser_->profile(); | 1452 Profile* profile = browser_->profile(); |
| 1452 views::WebView* web_view = new views::WebView(profile); | 1453 views::WebView* web_view = new views::WebView(profile); |
| 1453 web_view->LoadInitialURL(url); | 1454 web_view->LoadInitialURL(url); |
| 1454 web_view->SetPreferredSize( | 1455 web_view->SetPreferredSize( |
| 1455 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)); | 1456 gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)); |
| 1456 | 1457 content::RenderWidgetHostView* rwhv = |
| 1458 web_view->GetWebContents()->GetRenderWidgetHostView(); |
| 1459 if (rwhv) |
| 1460 rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor); |
| 1457 TitleCard* title_card = new TitleCard(l10n_util::GetStringUTF16(message_id), | 1461 TitleCard* title_card = new TitleCard(l10n_util::GetStringUTF16(message_id), |
| 1458 this, | 1462 this, |
| 1459 &gaia_signin_cancel_button_); | 1463 &gaia_signin_cancel_button_); |
| 1460 return TitleCard::AddPaddedTitleCard( | 1464 return TitleCard::AddPaddedTitleCard( |
| 1461 web_view, title_card, kFixedGaiaViewWidth); | 1465 web_view, title_card, kFixedGaiaViewWidth); |
| 1462 } | 1466 } |
| 1463 | 1467 |
| 1464 views::View* ProfileChooserView::CreateAccountRemovalView() { | 1468 views::View* ProfileChooserView::CreateAccountRemovalView() { |
| 1465 views::View* view = new views::View(); | 1469 views::View* view = new views::View(); |
| 1466 views::GridLayout* layout = CreateSingleColumnLayout( | 1470 views::GridLayout* layout = CreateSingleColumnLayout( |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1661 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1658 IncognitoModePrefs::DISABLED; | 1662 IncognitoModePrefs::DISABLED; |
| 1659 return incognito_available && !browser_->profile()->IsGuestSession(); | 1663 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1660 } | 1664 } |
| 1661 | 1665 |
| 1662 void ProfileChooserView::PostActionPerformed( | 1666 void ProfileChooserView::PostActionPerformed( |
| 1663 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1667 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1664 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1668 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1665 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1669 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1666 } | 1670 } |
| OLD | NEW |