| 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 20 matching lines...) Expand all  Loading... | 
| 31 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 31 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 
| 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/profile_oauth2_token_service.h" | 37 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 
| 38 #include "components/signin/core/browser/signin_error_controller.h" | 38 #include "components/signin/core/browser/signin_error_controller.h" | 
| 39 #include "components/signin/core/browser/signin_manager.h" | 39 #include "components/signin/core/browser/signin_manager.h" | 
| 40 #include "components/signin/core/common/profile_management_switches.h" | 40 #include "components/signin/core/common/profile_management_switches.h" | 
|  | 41 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 
| 41 #include "content/public/browser/render_widget_host_view.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/compositor/clip_transform_recorder.h" | 47 #include "ui/compositor/clip_transform_recorder.h" | 
| 47 #include "ui/gfx/canvas.h" | 48 #include "ui/gfx/canvas.h" | 
| 48 #include "ui/gfx/image/image.h" | 49 #include "ui/gfx/image/image.h" | 
| 49 #include "ui/gfx/image/image_skia.h" | 50 #include "ui/gfx/image/image_skia.h" | 
| 50 #include "ui/gfx/path.h" | 51 #include "ui/gfx/path.h" | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
| 66 #include "ui/views/layout/layout_constants.h" | 67 #include "ui/views/layout/layout_constants.h" | 
| 67 #include "ui/views/widget/widget.h" | 68 #include "ui/views/widget/widget.h" | 
| 68 | 69 | 
| 69 namespace { | 70 namespace { | 
| 70 | 71 | 
| 71 // Helpers -------------------------------------------------------------------- | 72 // Helpers -------------------------------------------------------------------- | 
| 72 | 73 | 
| 73 const int kFixedMenuWidth = 250; | 74 const int kFixedMenuWidth = 250; | 
| 74 const int kButtonHeight = 32; | 75 const int kButtonHeight = 32; | 
| 75 const int kFixedGaiaViewHeight = 440; | 76 const int kFixedGaiaViewHeight = 440; | 
| 76 const int kFixedGaiaViewWidth = 360; | 77 // TODO(wjmaclean): This next value needs to be wide enough for the SSL | 
|  | 78 // certificate selector box ... would it be easier to convince the certificate | 
|  | 79 // selector dialog to be resizable? | 
|  | 80 const int kFixedGaiaViewWidth = 500; | 
| 77 const int kFixedAccountRemovalViewWidth = 280; | 81 const int kFixedAccountRemovalViewWidth = 280; | 
| 78 const int kFixedSwitchUserViewWidth = 320; | 82 const int kFixedSwitchUserViewWidth = 320; | 
| 79 const int kLargeImageSide = 88; | 83 const int kLargeImageSide = 88; | 
| 80 | 84 | 
| 81 const int kVerticalSpacing = 16; | 85 const int kVerticalSpacing = 16; | 
| 82 | 86 | 
| 83 bool IsProfileChooser(profiles::BubbleViewMode mode) { | 87 bool IsProfileChooser(profiles::BubbleViewMode mode) { | 
| 84   return mode == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER || | 88   return mode == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER || | 
| 85       mode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER; | 89       mode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER; | 
| 86 } | 90 } | 
| (...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1530     default: | 1534     default: | 
| 1531       NOTREACHED() << "Called with invalid mode=" << view_mode_; | 1535       NOTREACHED() << "Called with invalid mode=" << view_mode_; | 
| 1532       return NULL; | 1536       return NULL; | 
| 1533   } | 1537   } | 
| 1534 | 1538 | 
| 1535   // Adds Gaia signin webview | 1539   // Adds Gaia signin webview | 
| 1536   Profile* profile = browser_->profile(); | 1540   Profile* profile = browser_->profile(); | 
| 1537   views::WebView* web_view = new views::WebView(profile); | 1541   views::WebView* web_view = new views::WebView(profile); | 
| 1538   web_view->LoadInitialURL(url); | 1542   web_view->LoadInitialURL(url); | 
| 1539   web_view->GetWebContents()->SetDelegate(this); | 1543   web_view->GetWebContents()->SetDelegate(this); | 
|  | 1544   web_modal::WebContentsModalDialogManager::CreateForWebContents( | 
|  | 1545       web_view->GetWebContents()); | 
|  | 1546   web_modal::WebContentsModalDialogManager::FromWebContents( | 
|  | 1547       web_view->GetWebContents()) | 
|  | 1548       ->SetDelegate(this); | 
|  | 1549 | 
| 1540   web_view->SetPreferredSize( | 1550   web_view->SetPreferredSize( | 
| 1541       gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)); | 1551       gfx::Size(kFixedGaiaViewWidth, kFixedGaiaViewHeight)); | 
| 1542   content::RenderWidgetHostView* rwhv = | 1552   content::RenderWidgetHostView* rwhv = | 
| 1543       web_view->GetWebContents()->GetRenderWidgetHostView(); | 1553       web_view->GetWebContents()->GetRenderWidgetHostView(); | 
| 1544   if (rwhv) | 1554   if (rwhv) | 
| 1545     rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor); | 1555     rwhv->SetBackgroundColor(profiles::kAvatarBubbleGaiaBackgroundColor); | 
| 1546   TitleCard* title_card = new TitleCard(l10n_util::GetStringUTF16(message_id), | 1556   TitleCard* title_card = new TitleCard(l10n_util::GetStringUTF16(message_id), | 
| 1547                                         this, | 1557                                         this, | 
| 1548                                         &gaia_signin_cancel_button_); | 1558                                         &gaia_signin_cancel_button_); | 
| 1549   if (signin_content_view) | 1559   if (signin_content_view) | 
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1747       IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1757       IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 
| 1748           IncognitoModePrefs::DISABLED; | 1758           IncognitoModePrefs::DISABLED; | 
| 1749   return incognito_available && !browser_->profile()->IsGuestSession(); | 1759   return incognito_available && !browser_->profile()->IsGuestSession(); | 
| 1750 } | 1760 } | 
| 1751 | 1761 | 
| 1752 void ProfileChooserView::PostActionPerformed( | 1762 void ProfileChooserView::PostActionPerformed( | 
| 1753     ProfileMetrics::ProfileDesktopMenu action_performed) { | 1763     ProfileMetrics::ProfileDesktopMenu action_performed) { | 
| 1754   ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1764   ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 
| 1755   gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1765   gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 
| 1756 } | 1766 } | 
|  | 1767 | 
|  | 1768 web_modal::WebContentsModalDialogHost* | 
|  | 1769 ProfileChooserView::GetWebContentsModalDialogHost() { | 
|  | 1770   return this; | 
|  | 1771 } | 
|  | 1772 | 
|  | 1773 gfx::Size ProfileChooserView::GetMaximumDialogSize() { | 
|  | 1774   return bounds().size(); | 
|  | 1775 } | 
|  | 1776 | 
|  | 1777 gfx::NativeView ProfileChooserView::GetHostView() const { | 
|  | 1778   return GetWidget()->GetNativeView(); | 
|  | 1779 } | 
|  | 1780 | 
|  | 1781 gfx::Point ProfileChooserView::GetDialogPosition(const gfx::Size& size) { | 
|  | 1782   return gfx::Point(); | 
|  | 1783 } | 
|  | 1784 | 
|  | 1785 void ProfileChooserView::AddObserver( | 
|  | 1786     web_modal::ModalDialogHostObserver* observer) {} | 
|  | 1787 | 
|  | 1788 void ProfileChooserView::RemoveObserver( | 
|  | 1789     web_modal::ModalDialogHostObserver* observer) {} | 
| OLD | NEW | 
|---|