diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-25 13:11:30 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-25 13:11:30 +0000 |
commit | 9f584e6a7f828816c9c6c0ba0ee822eb01fc3a06 (patch) | |
tree | 1be6fe88f5577d7c395dd3bf0c2cb255f03b9d81 | |
parent | e3270f1d393a374f3d60ffb532ec5d78ee674669 (diff) | |
download | chromium_src-9f584e6a7f828816c9c6c0ba0ee822eb01fc3a06.zip chromium_src-9f584e6a7f828816c9c6c0ba0ee822eb01fc3a06.tar.gz chromium_src-9f584e6a7f828816c9c6c0ba0ee822eb01fc3a06.tar.bz2 |
Revert 178795
Speculative revert to see whether this is responsible for CaptivePortalBrowserTest failures.
Tests are failing because there are more navigations happening than expected.
> Added signin support for the app launcher.
>
> This prompts the user to sign in if the app launcher is shown and there is no authenticated user in the Chrome profile. This does not happen on ChromeOS.
>
> BUG=159733
>
>
> Review URL: https://chromiumcodereview.appspot.com/12044002
TBR=benwells@chromium.org
Review URL: https://codereview.chromium.org/12052077
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178816 0039d316-1c4b-4281-b951-d872f2087c98
22 files changed, 30 insertions, 477 deletions
diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc index 59f79f2..daaa486 100644 --- a/ash/shell/app_list.cc +++ b/ash/shell/app_list.cc @@ -227,10 +227,6 @@ class ExampleAppListViewDelegate : public app_list::AppListViewDelegate { DecorateSearchBox(model_->search_box()); } - virtual app_list::SigninDelegate* GetSigninDelegate() OVERRIDE { - return NULL; - } - virtual void ActivateAppListItem(app_list::AppListItemModel* item, int event_flags) OVERRIDE { static_cast<WindowTypeLauncherItem*>(item)->Activate(event_flags); diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.cc b/chrome/browser/ui/app_list/app_list_view_delegate.cc index 0a2d68d..95ed009 100644 --- a/chrome/browser/ui/app_list/app_list_view_delegate.cc +++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc @@ -8,7 +8,6 @@ #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" #include "chrome/browser/ui/app_list/apps_model_builder.h" #include "chrome/browser/ui/app_list/chrome_app_list_item.h" -#include "chrome/browser/ui/app_list/chrome_signin_delegate.h" #include "chrome/browser/ui/app_list/search_builder.h" #include "content/public/browser/user_metrics.h" @@ -33,9 +32,6 @@ void AppListViewDelegate::SetModel(app_list::AppListModel* model) { model->search_box(), model->results(), controller_.get())); - - signin_delegate_.reset(new ChromeSigninDelegate(profile)); - #if defined(USE_ASH) app_sync_ui_state_watcher_.reset(new AppSyncUIStateWatcher(profile, model)); #endif @@ -48,10 +44,6 @@ void AppListViewDelegate::SetModel(app_list::AppListModel* model) { } } -app_list::SigninDelegate* AppListViewDelegate::GetSigninDelegate() { - return signin_delegate_.get(); -} - void AppListViewDelegate::ActivateAppListItem( app_list::AppListItemModel* item, int event_flags) { diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.h b/chrome/browser/ui/app_list/app_list_view_delegate.h index 0e2851d..2249dd9 100644 --- a/chrome/browser/ui/app_list/app_list_view_delegate.h +++ b/chrome/browser/ui/app_list/app_list_view_delegate.h @@ -14,7 +14,6 @@ class AppListControllerDelegate; class AppsModelBuilder; -class Profile; class SearchBuilder; #if defined(USE_ASH) @@ -30,7 +29,6 @@ class AppListViewDelegate : public app_list::AppListViewDelegate { private: // Overridden from app_list::AppListViewDelegate: virtual void SetModel(app_list::AppListModel* model) OVERRIDE; - virtual app_list::SigninDelegate* GetSigninDelegate() OVERRIDE; virtual void ActivateAppListItem(app_list::AppListItemModel* item, int event_flags) OVERRIDE; virtual void StartSearch() OVERRIDE; @@ -44,7 +42,6 @@ class AppListViewDelegate : public app_list::AppListViewDelegate { virtual void ViewClosing() OVERRIDE; virtual void ViewActivationChanged(bool active) OVERRIDE; - scoped_ptr<app_list::SigninDelegate> signin_delegate_; scoped_ptr<AppsModelBuilder> apps_builder_; scoped_ptr<SearchBuilder> search_builder_; scoped_ptr<AppListControllerDelegate> controller_; diff --git a/chrome/browser/ui/app_list/chrome_signin_delegate.cc b/chrome/browser/ui/app_list/chrome_signin_delegate.cc deleted file mode 100644 index dd54c6b..0000000 --- a/chrome/browser/ui/app_list/chrome_signin_delegate.cc +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/app_list/chrome_signin_delegate.h" - -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/profiles/profile_metrics.h" -#include "chrome/browser/signin/signin_manager.h" -#include "chrome/browser/signin/signin_manager_factory.h" -#include "chrome/browser/sync/profile_sync_service.h" -#include "chrome/browser/sync/profile_sync_service_factory.h" -#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" -#include "content/public/browser/navigation_controller.h" -#include "content/public/browser/site_instance.h" -#include "content/public/browser/web_contents.h" -#include "ui/app_list/signin_delegate_observer.h" - -#if defined(ENABLE_ONE_CLICK_SIGNIN) -#include "chrome/browser/ui/sync/one_click_signin_helper.h" -#endif - -using content::WebContents; - -namespace { - -ProfileSyncService* GetSyncService(Profile* profile) { - return ProfileSyncServiceFactory::GetForProfile(profile); -} - -LoginUIService* GetLoginUIService(Profile* profile) { - return LoginUIServiceFactory::GetForProfile(profile); -} - -SigninManager* GetSigninManager(Profile* profile) { - return SigninManagerFactory::GetForProfile(profile); -} - -} // namespace - -ChromeSigninDelegate::ChromeSigninDelegate(Profile* profile) - : profile_(profile) {} - -bool ChromeSigninDelegate::NeedSignin() { -#if defined(USE_ASH) - return false; -#else - if (!profile_) - return false; - - return GetSigninManager(profile_)->GetAuthenticatedUsername().empty(); -#endif -} - -WebContents* ChromeSigninDelegate::PrepareForSignin() { - DCHECK(!IsActiveSignin()); - - if (!GetLoginUIService(profile_)) - return NULL; - - signin_tracker_.reset(new SigninTracker(profile_, this)); - - if (GetLoginUIService(profile_)->current_login_ui()) - GetLoginUIService(profile_)->current_login_ui()->CloseUI(); - - GetLoginUIService(profile_)->SetLoginUI(this); - - if (!GetSyncService(profile_)) - return NULL; - - GetSyncService(profile_)->UnsuppressAndStart(); - -#if defined(ENABLE_ONE_CLICK_SIGNIN) - GURL url("https://accounts.google.com/ServiceLogin?service=chromiumsync&" - "sarp=1&rm=hide&continue=https://www.google.com/intl/en-US/" - "chrome/blank.html?source=2"); - - WebContents::CreateParams params = WebContents::CreateParams( - profile_, content::SiteInstance::CreateForURL(profile_, url)); - WebContents* web_contents = WebContents::Create(params); - if (OneClickSigninHelper::CanOffer( - web_contents, OneClickSigninHelper::CAN_OFFER_FOR_ALL, "", NULL)) { - OneClickSigninHelper::CreateForWebContents(web_contents); - } - - web_contents->GetController().LoadURL( - url, content::Referrer(), content::PAGE_TRANSITION_LINK, - std::string()); - return web_contents; -#else - NOTREACHED(); - return NULL; -#endif -} - -ChromeSigninDelegate::~ChromeSigninDelegate() { - FinishSignin(); -} - -bool ChromeSigninDelegate::IsActiveSignin() { - if (!GetLoginUIService(profile_)) - return false; - - return GetLoginUIService(profile_)->current_login_ui() == this; -} - -void ChromeSigninDelegate::FinishSignin() { - if (!IsActiveSignin()) - return; - - GetLoginUIService(profile_)->LoginUIClosed(this); -} - -void ChromeSigninDelegate::FocusUI() { - // The launcher gets hidden if it is not focused, so if it is visible it - // is focused. Hence, nothing to do here. -} - -void ChromeSigninDelegate::CloseUI() { - // TODO: remove tab contents helper - // This can't happen, as the launcher keeps focus, but do something sensible - // nonetheless. - FinishSignin(); -} - -void ChromeSigninDelegate::GaiaCredentialsValid() { -} - -void ChromeSigninDelegate::SigninFailed(const GoogleServiceAuthError& error) { -} - -void ChromeSigninDelegate::SigninSuccess() { - if (!IsActiveSignin()) - return; - - FinishSignin(); - NotifySigninSuccess(); -} diff --git a/chrome/browser/ui/app_list/chrome_signin_delegate.h b/chrome/browser/ui/app_list/chrome_signin_delegate.h deleted file mode 100644 index 3b4d1eb..0000000 --- a/chrome/browser/ui/app_list/chrome_signin_delegate.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_APP_LIST_CHROME_SIGNIN_DELEGATE_H_ -#define CHROME_BROWSER_UI_APP_LIST_CHROME_SIGNIN_DELEGATE_H_ - -#include "base/basictypes.h" -#include "base/memory/scoped_ptr.h" -#include "chrome/browser/signin/signin_tracker.h" -#include "chrome/browser/ui/webui/signin/login_ui_service.h" -#include "ui/app_list/signin_delegate.h" - -class Profile; - -class ChromeSigninDelegate : public app_list::SigninDelegate, - public LoginUIService::LoginUI, - public SigninTracker::Observer { - public: - explicit ChromeSigninDelegate(Profile* profile); - - private: - virtual ~ChromeSigninDelegate(); - - bool IsActiveSignin(); - void FinishSignin(); - - // Overridden from app_list::SigninDelegate: - virtual bool NeedSignin() OVERRIDE; - virtual content::WebContents* PrepareForSignin() OVERRIDE; - - // Overridden from LoginUIService::LoginUI: - virtual void FocusUI() OVERRIDE; - virtual void CloseUI() OVERRIDE; - - // Overridden from SigninTracker::Observer: - virtual void GaiaCredentialsValid() OVERRIDE; - virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; - virtual void SigninSuccess() OVERRIDE; - - Profile* profile_; - - scoped_ptr<SigninTracker> signin_tracker_; - - DISALLOW_COPY_AND_ASSIGN(ChromeSigninDelegate); -}; - -#endif // CHROME_BROWSER_UI_APP_LIST_CHROME_SIGNIN_DELEGATE_H_ diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc index e38dd98..94b9116 100644 --- a/chrome/browser/ui/sync/one_click_signin_helper.cc +++ b/chrome/browser/ui/sync/one_click_signin_helper.cc @@ -83,16 +83,15 @@ void AddEmailToOneClickRejectedList(Profile* profile, } // Start syncing with the given user information. -void StartSync(Profile* profile, - Browser* browser, +void StartSync(Browser* browser, OneClickSigninHelper::AutoAccept auto_accept, const std::string& session_index, const std::string& email, const std::string& password, OneClickSigninSyncStarter::StartSyncMode start_mode) { // The starter deletes itself once its done. - new OneClickSigninSyncStarter(profile, browser, session_index, email, - password, start_mode); + new OneClickSigninSyncStarter(browser, session_index, email, password, + start_mode); int action = one_click_signin::HISTOGRAM_MAX; switch (auto_accept) { @@ -351,7 +350,7 @@ bool OneClickInfoBarDelegateImpl::Accept() { RecordHistogramAction(one_click_signin::HISTOGRAM_ACCEPTED); chrome::FindBrowserWithWebContents(web_contents)->window()-> ShowOneClickSigninBubble( - base::Bind(&StartSync, profile, browser, + base::Bind(&StartSync, browser, OneClickSigninHelper::AUTO_ACCEPT_NONE, session_index_, email_, password_)); button_pressed_ = true; @@ -905,17 +904,17 @@ void OneClickSigninHelper::DidStopLoading( case AUTO_ACCEPT_ACCEPTED: SigninManager::DisableOneClickSignIn(profile); browser->window()->ShowOneClickSigninBubble( - base::Bind(&StartSync, profile, browser, auto_accept_, session_index_, + base::Bind(&StartSync, browser, auto_accept_, session_index_, email_, password_)); break; case AUTO_ACCEPT_CONFIGURE: SigninManager::DisableOneClickSignIn(profile); - StartSync(profile, browser, auto_accept_, session_index_, email_, - password_, OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST); + StartSync(browser, auto_accept_, session_index_, email_, password_, + OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST); break; case AUTO_ACCEPT_EXPLICIT: - StartSync(profile, browser, auto_accept_, session_index_, email_, - password_, source_ == SyncPromoUI::SOURCE_SETTINGS ? + StartSync(browser, auto_accept_, session_index_, email_, password_, + source_ == SyncPromoUI::SOURCE_SETTINGS ? OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST : OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc index 3be7fc5..295df44 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc +++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc @@ -18,30 +18,29 @@ #include "chrome/common/url_constants.h" OneClickSigninSyncStarter::OneClickSigninSyncStarter( - Profile* profile, Browser* browser, const std::string& session_index, const std::string& email, const std::string& password, StartSyncMode start_mode) - : profile_(profile), - browser_(browser), - signin_tracker_(profile_, this), + : browser_(browser), + signin_tracker_(browser_->profile(), this), start_mode_(start_mode) { - DCHECK(profile_); + DCHECK(browser_); // Let the sync service know that setup is in progress so it doesn't start // syncing until the user has finished any configuration. ProfileSyncService* profile_sync_service = - ProfileSyncServiceFactory::GetForProfile(profile_); + ProfileSyncServiceFactory::GetForProfile(browser_->profile()); profile_sync_service->SetSetupInProgress(true); // Make sure the syncing is not suppressed, otherwise the SigninManager // will not be able to compelte sucessfully. - browser_sync::SyncPrefs sync_prefs(profile_->GetPrefs()); + browser_sync::SyncPrefs sync_prefs(browser_->profile()->GetPrefs()); sync_prefs.SetStartSuppressed(false); - SigninManager* manager = SigninManagerFactory::GetForProfile(profile_); + SigninManager* manager = SigninManagerFactory::GetForProfile( + browser_->profile()); manager->StartSignInWithCredentials(session_index, email, password); } @@ -54,14 +53,14 @@ void OneClickSigninSyncStarter::GaiaCredentialsValid() { void OneClickSigninSyncStarter::SigninFailed( const GoogleServiceAuthError& error) { ProfileSyncService* profile_sync_service = - ProfileSyncServiceFactory::GetForProfile(profile_); + ProfileSyncServiceFactory::GetForProfile(browser_->profile()); profile_sync_service->SetSetupInProgress(false); delete this; } void OneClickSigninSyncStarter::SigninSuccess() { ProfileSyncService* profile_sync_service = - ProfileSyncServiceFactory::GetForProfile(profile_); + ProfileSyncServiceFactory::GetForProfile(browser_->profile()); switch (start_mode_) { case SYNC_WITH_DEFAULT_SETTINGS: @@ -75,10 +74,11 @@ void OneClickSigninSyncStarter::SigninSuccess() { // ProfileSyncService::setup_in_progress flag because we don't want sync // to start up until after the configure UI is displayed (the configure UI // will clear the flag when the user is done setting up sync). - LoginUIService* login_ui = LoginUIServiceFactory::GetForProfile(profile_); + LoginUIService* login_ui = LoginUIServiceFactory::GetForProfile( + browser_->profile()); if (login_ui->current_login_ui()) { login_ui->current_login_ui()->FocusUI(); - } else if (browser_) { + } else { // Need to navigate to the settings page and display the UI. chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage); } diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.h b/chrome/browser/ui/sync/one_click_signin_sync_starter.h index 6860fb7..9eb5e8a 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_starter.h +++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.h @@ -27,10 +27,7 @@ class OneClickSigninSyncStarter : public SigninTracker::Observer { CONFIGURE_SYNC_FIRST }; - // |profile| must not be NULL, however |browser| can be. When using the - // OneClickSigninSyncStarter from a browser, provide both. - OneClickSigninSyncStarter(Profile* profile, - Browser* browser, + OneClickSigninSyncStarter(Browser* browser, const std::string& session_index, const std::string& email, const std::string& password, @@ -44,7 +41,6 @@ class OneClickSigninSyncStarter : public SigninTracker::Observer { virtual void SigninFailed(const GoogleServiceAuthError& error) OVERRIDE; virtual void SigninSuccess() OVERRIDE; - Profile* profile_; Browser* browser_; SigninTracker signin_tracker_; StartSyncMode start_mode_; diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index d03113b..957bf1d 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -106,8 +106,6 @@ 'browser/ui/app_list/apps_model_builder.cc', 'browser/ui/app_list/apps_model_builder.h', 'browser/ui/app_list/chrome_app_list_item.h', - 'browser/ui/app_list/chrome_signin_delegate.cc', - 'browser/ui/app_list/chrome_signin_delegate.h', 'browser/ui/app_list/extension_app_item.cc', 'browser/ui/app_list/extension_app_item.h', 'browser/ui/app_list/search_builder.cc', diff --git a/ui/app_list/app_list.gyp b/ui/app_list/app_list.gyp index 705ca73..488f172 100644 --- a/ui/app_list/app_list.gyp +++ b/ui/app_list/app_list.gyp @@ -49,9 +49,6 @@ 'search_result.h', 'search_result_list_view_delegate.h', 'search_result_view_delegate.h', - 'signin_delegate.cc', - 'signin_delegate.h', - 'signin_delegate_observer.h', 'views/app_list_background.cc', 'views/app_list_background.h', 'views/app_list_item_view.cc', @@ -74,8 +71,6 @@ 'views/search_result_list_view.h', 'views/search_result_view.cc', 'views/search_result_view.h', - 'views/signin_view.cc', - 'views/signin_view.h', ], 'conditions': [ ['use_aura==1', { @@ -85,8 +80,6 @@ }], ['toolkit_views==1', { 'dependencies': [ - '../../content/content.gyp:content_browser', - '../views/controls/webview/webview.gyp:webview', '../views/views.gyp:views', ], }, { # toolkit_views==0 diff --git a/ui/app_list/app_list_view_delegate.h b/ui/app_list/app_list_view_delegate.h index 5143544..a9d73a4 100644 --- a/ui/app_list/app_list_view_delegate.h +++ b/ui/app_list/app_list_view_delegate.h @@ -12,7 +12,6 @@ namespace app_list { class AppListItemModel; class AppListModel; class SearchResult; -class SigninDelegate; class APP_LIST_EXPORT AppListViewDelegate { public: @@ -23,9 +22,6 @@ class APP_LIST_EXPORT AppListViewDelegate { // Note that AppListView owns the model. virtual void SetModel(AppListModel* model) = 0; - // Gets the SigninDelegate for the app list. Owned by the AppListViewDelegate. - virtual SigninDelegate* GetSigninDelegate() = 0; - // Invoked when an AppListeItemModelView is activated by click or enter key. virtual void ActivateAppListItem(AppListItemModel* item, int event_flags) = 0; diff --git a/ui/app_list/signin_delegate.cc b/ui/app_list/signin_delegate.cc deleted file mode 100644 index 51eb830..0000000 --- a/ui/app_list/signin_delegate.cc +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/app_list/signin_delegate.h" -#include "ui/app_list/signin_delegate_observer.h" - -namespace app_list { - -SigninDelegate::SigninDelegate() {} - -SigninDelegate::~SigninDelegate() {} - -void SigninDelegate::AddObserver(SigninDelegateObserver* observer) { - observers_.AddObserver(observer); -} - -void SigninDelegate::RemoveObserver(SigninDelegateObserver* observer) { - observers_.RemoveObserver(observer); -} - -void SigninDelegate::NotifySigninSuccess() { - FOR_EACH_OBSERVER(app_list::SigninDelegateObserver, observers_, - OnSigninSuccess()); -} - -} // namespace app_list diff --git a/ui/app_list/signin_delegate.h b/ui/app_list/signin_delegate.h deleted file mode 100644 index aa24093..0000000 --- a/ui/app_list/signin_delegate.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_APP_LIST_SIGNIN_DELEGATE_H_ -#define UI_APP_LIST_SIGNIN_DELEGATE_H_ - -#include "base/basictypes.h" -#include "base/observer_list.h" -#include "ui/app_list/app_list_export.h" - -namespace content { -class BrowserContext; -class WebContents; -} - -namespace app_list { - -class SigninDelegateObserver; - -class APP_LIST_EXPORT SigninDelegate { - public: - SigninDelegate(); - virtual ~SigninDelegate(); - - virtual bool NeedSignin() = 0; - virtual content::WebContents* PrepareForSignin() = 0; - - void AddObserver(SigninDelegateObserver* observer); - void RemoveObserver(SigninDelegateObserver* observer); - - protected: - void NotifySigninSuccess(); - - private: - ObserverList<SigninDelegateObserver, true> observers_; - - DISALLOW_COPY_AND_ASSIGN(SigninDelegate); -}; - -} // namespace app_list - -#endif // UI_APP_LIST_SIGNIN_DELEGATE_H_ diff --git a/ui/app_list/signin_delegate_observer.h b/ui/app_list/signin_delegate_observer.h deleted file mode 100644 index 47c49926..0000000 --- a/ui/app_list/signin_delegate_observer.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_APP_LIST_SIGNIN_DELEGATE_OBSERVER_H_ -#define UI_APP_LIST_SIGNIN_DELEGATE_OBSERVER_H_ - -#include "ui/app_list/app_list_export.h" - -namespace app_list { - -// Abstract interface to allow handling app list signin success. -class APP_LIST_EXPORT SigninDelegateObserver { - public: - // Called by the SigninDelegate when signin has successfully completed. - virtual void OnSigninSuccess() = 0; - - protected: - virtual ~SigninDelegateObserver() {} -}; - -} // namespace app_list - -#endif // UI_APP_LIST_SIGNIN_DELEGATE_OBSERVER_H_ diff --git a/ui/app_list/views/DEPS b/ui/app_list/views/DEPS deleted file mode 100644 index fe7bb13..0000000 --- a/ui/app_list/views/DEPS +++ /dev/null @@ -1,3 +0,0 @@ -include_rules = [ - "+content/public", -] diff --git a/ui/app_list/views/app_list_main_view.cc b/ui/app_list/views/app_list_main_view.cc index f73f428..b54a5ca 100644 --- a/ui/app_list/views/app_list_main_view.cc +++ b/ui/app_list/views/app_list_main_view.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/ui/app_list/views/app_list_main_view.h b/ui/app_list/views/app_list_main_view.h index ee005f9..d51595a 100644 --- a/ui/app_list/views/app_list_main_view.h +++ b/ui/app_list/views/app_list_main_view.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/ui/app_list/views/app_list_view.cc b/ui/app_list/views/app_list_view.cc index 5545e0c..c288689 100644 --- a/ui/app_list/views/app_list_view.cc +++ b/ui/app_list/views/app_list_view.cc @@ -9,11 +9,9 @@ #include "ui/app_list/app_list_model.h" #include "ui/app_list/app_list_view_delegate.h" #include "ui/app_list/pagination_model.h" -#include "ui/app_list/signin_delegate.h" #include "ui/app_list/views/app_list_background.h" #include "ui/app_list/views/app_list_main_view.h" #include "ui/app_list/views/search_box_view.h" -#include "ui/app_list/views/signin_view.h" #include "ui/gfx/insets.h" #include "ui/gfx/path.h" #include "ui/gfx/skia_util.h" @@ -37,18 +35,12 @@ const int kArrowOffset = 10; AppListView::AppListView(AppListViewDelegate* delegate) : model_(new AppListModel), delegate_(delegate), - app_list_main_view_(NULL), - signin_view_(NULL) { + app_list_main_view_(NULL) { if (delegate_) delegate_->SetModel(model_.get()); - if (GetSigninDelegate()) - GetSigninDelegate()->AddObserver(this); } AppListView::~AppListView() { - if (GetSigninDelegate()) - GetSigninDelegate()->RemoveObserver(this); - // Models are going away, ensure their references are cleared. RemoveAllChildViews(true); } @@ -59,22 +51,19 @@ void AppListView::InitAsBubble( views::View* anchor, const gfx::Point& anchor_point, views::BubbleBorder::ArrowLocation arrow_location) { - app_list_main_view_ = new AppListMainView(delegate_.get(), model_.get(), pagination_model, anchor); - AddChildView(app_list_main_view_); + SetLayoutManager(new views::FillLayout()); + #if defined(USE_AURA) app_list_main_view_->SetPaintToLayer(true); app_list_main_view_->SetFillsBoundsOpaquely(false); app_list_main_view_->layer()->SetMasksToBounds(true); #endif - if (GetSigninDelegate() && GetSigninDelegate()->NeedSignin()) { - signin_view_ = new SigninView(GetSigninDelegate()); - AddChildView(signin_view_); - } + AddChildView(app_list_main_view_); set_anchor_view(anchor); set_anchor_point(anchor_point); @@ -132,10 +121,6 @@ void AppListView::UpdateBounds() { SizeToContents(); } -gfx::Size AppListView::GetPreferredSize() { - return app_list_main_view_->GetPreferredSize(); -} - views::View* AppListView::GetInitiallyFocusedView() { return app_list_main_view_->search_box_view()->search_box(); } @@ -160,22 +145,6 @@ bool AppListView::AcceleratorPressed(const ui::Accelerator& accelerator) { return false; } -void AppListView::Layout() { - if (!signin_view_) { - app_list_main_view_->SetBounds(0, 0, width(), height()); - return; - } - - if (GetSigninDelegate() && GetSigninDelegate()->NeedSignin()) { - signin_view_->SetBounds(0, 0, width(), height()); - app_list_main_view_->SetBounds(width(), 0, width(), height()); - return; - } - - signin_view_->SetBounds(-width(), 0, width(), height()); - app_list_main_view_->SetBounds(0, 0, width(), height()); -} - void AppListView::OnWidgetClosing(views::Widget* widget) { BubbleDelegateView::OnWidgetClosing(widget); if (delegate_.get() && widget == GetWidget()) @@ -190,12 +159,4 @@ void AppListView::OnWidgetActivationChanged(views::Widget* widget, delegate_->ViewActivationChanged(active); } -void AppListView::OnSigninSuccess() { - Layout(); -} - -SigninDelegate* AppListView::GetSigninDelegate() { - return delegate_ ? delegate_->GetSigninDelegate() : NULL; -} - } // namespace app_list diff --git a/ui/app_list/views/app_list_view.h b/ui/app_list/views/app_list_view.h index bb9af49..652a5c8 100644 --- a/ui/app_list/views/app_list_view.h +++ b/ui/app_list/views/app_list_view.h @@ -7,7 +7,6 @@ #include "base/memory/scoped_ptr.h" #include "ui/app_list/app_list_export.h" -#include "ui/app_list/signin_delegate_observer.h" #include "ui/views/bubble/bubble_delegate.h" namespace views { @@ -20,13 +19,10 @@ class AppListMainView; class AppListModel; class AppListViewDelegate; class PaginationModel; -class SigninDelegate; -class SigninView; // AppListView is the top-level view and controller of app list UI. It creates // and hosts a AppsGridView and passes AppListModel to it for display. -class APP_LIST_EXPORT AppListView : public views::BubbleDelegateView, - public SigninDelegateObserver { +class APP_LIST_EXPORT AppListView : public views::BubbleDelegateView { public: // Takes ownership of |delegate|. explicit AppListView(AppListViewDelegate* delegate); @@ -52,9 +48,6 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDelegateView, void UpdateBounds(); - // Overridden from views::View: - virtual gfx::Size GetPreferredSize() OVERRIDE; - private: // Overridden from views::WidgetDelegateView: virtual views::View* GetInitiallyFocusedView() OVERRIDE; @@ -63,23 +56,16 @@ class APP_LIST_EXPORT AppListView : public views::BubbleDelegateView, // Overridden from views::View: virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; - virtual void Layout() OVERRIDE; // Overridden from views::WidgetObserver: virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; virtual void OnWidgetActivationChanged(views::Widget* widget, bool active) OVERRIDE; - // Overridden from SigninDelegateObserver: - virtual void OnSigninSuccess() OVERRIDE; - - SigninDelegate* GetSigninDelegate(); - scoped_ptr<AppListModel> model_; scoped_ptr<AppListViewDelegate> delegate_; AppListMainView* app_list_main_view_; - SigninView* signin_view_; DISALLOW_COPY_AND_ASSIGN(AppListView); }; diff --git a/ui/app_list/views/search_box_view.cc b/ui/app_list/views/search_box_view.cc index f98a198..b54203c 100644 --- a/ui/app_list/views/search_box_view.cc +++ b/ui/app_list/views/search_box_view.cc @@ -151,3 +151,4 @@ void SearchBoxView::TextChanged() { } } // namespace app_list + diff --git a/ui/app_list/views/signin_view.cc b/ui/app_list/views/signin_view.cc deleted file mode 100644 index 49c8a69..0000000 --- a/ui/app_list/views/signin_view.cc +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/app_list/views/signin_view.h" - -#include "content/public/browser/web_contents.h" -#include "ui/app_list/signin_delegate.h" -#include "ui/views/controls/webview/webview.h" -#include "ui/views/layout/fill_layout.h" - -namespace app_list { - -SigninView::SigninView(SigninDelegate* delegate) - : web_view_(new views::WebView(NULL)) { - DCHECK(delegate); - SetLayoutManager(new views::FillLayout()); - AddChildView(web_view_); - web_contents_.reset(delegate->PrepareForSignin()); -} - -SigninView::~SigninView() { - web_view_->SetWebContents(NULL); -} - -void SigninView::ViewHierarchyChanged(bool is_add, - views::View* parent, - views::View* child) { - if (is_add && child == this) - web_view_->SetWebContents(web_contents_.get()); -} - -} // namespace app_list diff --git a/ui/app_list/views/signin_view.h b/ui/app_list/views/signin_view.h deleted file mode 100644 index ee8404f..0000000 --- a/ui/app_list/views/signin_view.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_APP_LIST_VIEWS_SIGNIN_VIEW_H_ -#define UI_APP_LIST_VIEWS_SIGNIN_VIEW_H_ - -#include "base/basictypes.h" -#include "base/compiler_specific.h" -#include "base/memory/scoped_ptr.h" -#include "ui/views/view.h" - -namespace content { -class WebContents; -} - -namespace views { -class WebView; -} - -namespace app_list { - -class SigninDelegate; - -// The SigninView is shown in the app list when the user needs to sign in. -// It just shows a webview, which is prepared for signin by the signin delegate. -class SigninView : public views::View { - public: - SigninView(SigninDelegate* delegate); - virtual ~SigninView(); - - private: - // Overridden from views::View: - virtual void ViewHierarchyChanged(bool is_add, - views::View* parent, - views::View* child) OVERRIDE; - - scoped_ptr<content::WebContents> web_contents_; - views::WebView* web_view_; - - DISALLOW_COPY_AND_ASSIGN(SigninView); -}; - -} // namespace app_list - -#endif // UI_APP_LIST_VIEWS_SIGNIN_VIEW_H_ |