diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/cocoa/preferences_window_controller.mm | 6 | ||||
-rw-r--r-- | chrome/browser/dom_ui/new_tab_page_sync_handler.cc | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/bookmark_bar_gtk.cc | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/options/content_page_gtk.cc | 6 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.cc | 11 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service.h | 6 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service_startup_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_flow.cc | 5 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_flow.h | 3 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard.cc | 13 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard.h | 5 | ||||
-rw-r--r-- | chrome/browser/sync/sync_ui_util.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_bar_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/options/content_page_view.cc | 6 |
15 files changed, 46 insertions, 29 deletions
diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm index 2c15e993..0aa1501 100644 --- a/chrome/browser/cocoa/preferences_window_controller.mm +++ b/chrome/browser/cocoa/preferences_window_controller.mm @@ -1285,7 +1285,7 @@ const int kDisabledIndex = 1; } else { // Otherwise, the sync button was a "sync my bookmarks" button. // Kick off the sync setup process. - syncService_->EnableForUser(); + syncService_->EnableForUser(NULL); ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_OPTIONS); } } @@ -1303,12 +1303,12 @@ const int kDisabledIndex = 1; // "Personal Stuff" pane. Spawns a dialog-modal sheet that cleans // itself up on close. - (IBAction)doSyncCustomize:(id)sender { - syncService_->ShowChooseDataTypes(); + syncService_->ShowChooseDataTypes(NULL); } - (IBAction)doSyncReauthentication:(id)sender { DCHECK(syncService_ && !syncService_->IsManaged()); - syncService_->ShowLoginDialog(); + syncService_->ShowLoginDialog(NULL); } - (void)setPasswordManagerEnabledIndex:(NSInteger)value { diff --git a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc index b7349fd..9b0d0c9 100644 --- a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc +++ b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc @@ -157,7 +157,7 @@ void NewTabPageSyncHandler::HandleSyncLinkClicked(const Value* value) { GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS || sync_service_->GetAuthError().state() == GoogleServiceAuthError::CAPTCHA_REQUIRED) { - sync_service_->ShowLoginDialog(); + sync_service_->ShowLoginDialog(NULL); return; } DictionaryValue value; @@ -168,7 +168,7 @@ void NewTabPageSyncHandler::HandleSyncLinkClicked(const Value* value) { } else { // User clicked the 'Start now' link to begin syncing. ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_NTP); - sync_service_->EnableForUser(); + sync_service_->EnableForUser(NULL); } } diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc index 7712196..cce885e 100644 --- a/chrome/browser/gtk/bookmark_bar_gtk.cc +++ b/chrome/browser/gtk/bookmark_bar_gtk.cc @@ -999,7 +999,7 @@ gboolean BookmarkBarGtk::OnSyncErrorButtonPressed(GtkWidget* sender, GdkEventButton* event) { if (sender == sync_error_button_) { DCHECK(sync_service_ && !sync_service_->IsManaged()); - sync_service_->ShowLoginDialog(); + sync_service_->ShowLoginDialog(NULL); } return FALSE; diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/gtk/options/content_page_gtk.cc index fa34529..4d86fbd 100644 --- a/chrome/browser/gtk/options/content_page_gtk.cc +++ b/chrome/browser/gtk/options/content_page_gtk.cc @@ -573,7 +573,7 @@ void ContentPageGtk::OnSyncStartStopButtonClicked(GtkWidget* widget) { gtk_util::ShowDialog(dialog); return; } else { - sync_service_->EnableForUser(); + sync_service_->EnableForUser(NULL); ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_OPTIONS); } } @@ -582,12 +582,12 @@ void ContentPageGtk::OnSyncCustomizeButtonClicked(GtkWidget* widget) { // sync_customize_button_ should be invisible if sync is not yet set up. DCHECK(sync_service_ && !sync_service_->IsManaged() && sync_service_->HasSyncSetupCompleted()); - sync_service_->ShowChooseDataTypes(); + sync_service_->ShowChooseDataTypes(NULL); } void ContentPageGtk::OnSyncActionLinkClicked(GtkWidget* widget) { DCHECK(sync_service_ && !sync_service_->IsManaged()); - sync_service_->ShowLoginDialog(); + sync_service_->ShowChooseDataTypes(NULL); } void ContentPageGtk::OnStopSyncDialogResponse(GtkWidget* widget, int response) { diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index 168a379..1d46b7e 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -323,7 +323,7 @@ void ProfileSyncService::Shutdown(bool sync_disabled) { last_attempted_user_email_.clear(); } -void ProfileSyncService::EnableForUser() { +void ProfileSyncService::EnableForUser(gfx::NativeWindow parent_window) { if (WizardIsVisible()) { wizard_.Focus(); return; @@ -331,6 +331,7 @@ void ProfileSyncService::EnableForUser() { expecting_first_run_auth_needed_event_ = true; DCHECK(!data_type_manager_.get()); + wizard_.SetParent(parent_window); StartUp(); FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged()); } @@ -486,7 +487,7 @@ void ProfileSyncService::OnStopSyncingPermanently() { DisableForUser(); } -void ProfileSyncService::ShowLoginDialog() { +void ProfileSyncService::ShowLoginDialog(gfx::NativeWindow parent_window) { if (WizardIsVisible()) { wizard_.Focus(); return; @@ -499,16 +500,17 @@ void ProfileSyncService::ShowLoginDialog() { } if (last_auth_error_.state() != AuthError::NONE) { + wizard_.SetParent(parent_window); wizard_.Step(SyncSetupWizard::GAIA_LOGIN); } } -void ProfileSyncService::ShowChooseDataTypes() { +void ProfileSyncService::ShowChooseDataTypes(gfx::NativeWindow parent_window) { if (WizardIsVisible()) { wizard_.Focus(); return; } - + wizard_.SetParent(parent_window); wizard_.Step(SyncSetupWizard::CHOOSE_DATA_TYPES); } @@ -603,6 +605,7 @@ void ProfileSyncService::OnUserCancelledDialog() { // Rollback. DisableForUser(); } + wizard_.SetParent(NULL); // Though an auth could still be in progress, once the dialog is closed we // don't want the UI to stay stuck in the "waiting for authentication" state diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index bc55429..41c8054 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -132,7 +132,7 @@ class ProfileSyncService : public browser_sync::SyncFrontend, browser_sync::DataTypeController::StateMap* state_map) const; // Enables/disables sync for user. - virtual void EnableForUser(); + virtual void EnableForUser(gfx::NativeWindow parent_window); virtual void DisableForUser(); // Whether sync is enabled by user or not. @@ -182,9 +182,9 @@ class ProfileSyncService : public browser_sync::SyncFrontend, bool WizardIsVisible() const { return wizard_.IsVisible(); } - void ShowLoginDialog(); + void ShowLoginDialog(gfx::NativeWindow parent_window); - void ShowChooseDataTypes(); + void ShowChooseDataTypes(gfx::NativeWindow parent_window); // Pretty-printed strings for a given StatusSummary. static std::wstring BuildSyncStatusSummaryText( diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc index 63df954..a9d7944 100644 --- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc @@ -103,7 +103,7 @@ TEST_F(ProfileSyncServiceStartupTest, SKIP_MACOSX(StartFirstTime)) { WillOnce(Return(DataTypeManager::CONFIGURED)); EXPECT_CALL(*data_type_manager, Stop()).Times(1); EXPECT_CALL(observer_, OnStateChanged()).Times(4); - service_->EnableForUser(); + service_->EnableForUser(NULL); syncable::ModelTypeSet set; set.insert(syncable::BOOKMARKS); service_->OnUserChoseDatatypes(false, set); diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index c95fd75..56f8585 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -1359,7 +1359,7 @@ TEST_F(ProfileSyncServiceTestWithData, TestStartupWithOldSyncData) { ASSERT_FALSE(service_->HasSyncSetupCompleted()); // This will actually start up the sync service. - service_->EnableForUser(); + service_->EnableForUser(NULL); syncable::ModelTypeSet set; set.insert(syncable::BOOKMARKS); service_->OnUserChoseDatatypes(false, set); diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc index b1063bb..5eb62d6 100644 --- a/chrome/browser/sync/sync_setup_flow.cc +++ b/chrome/browser/sync/sync_setup_flow.cc @@ -469,7 +469,8 @@ void SyncSetupFlow::Focus() { SyncSetupFlow* SyncSetupFlow::Run(ProfileSyncService* service, SyncSetupFlowContainer* container, SyncSetupWizard::State start, - SyncSetupWizard::State end) { + SyncSetupWizard::State end, + gfx::NativeWindow parent_window) { DictionaryValue args; if (start == SyncSetupWizard::GAIA_LOGIN) SyncSetupFlow::GetArgsForGaiaLogin(service, &args); @@ -492,7 +493,7 @@ SyncSetupFlow* SyncSetupFlow::Run(ProfileSyncService* service, #else Browser* b = BrowserList::GetLastActive(); if (b) { - b->BrowserShowHtmlDialog(flow, NULL); + b->BrowserShowHtmlDialog(flow, parent_window); } else { delete flow; return NULL; diff --git a/chrome/browser/sync/sync_setup_flow.h b/chrome/browser/sync/sync_setup_flow.h index f67434c..c59c91a 100644 --- a/chrome/browser/sync/sync_setup_flow.h +++ b/chrome/browser/sync/sync_setup_flow.h @@ -33,7 +33,8 @@ class SyncSetupFlow : public HtmlDialogUIDelegate { static SyncSetupFlow* Run(ProfileSyncService* service, SyncSetupFlowContainer* container, SyncSetupWizard::State start, - SyncSetupWizard::State end); + SyncSetupWizard::State end, + gfx::NativeWindow parent_window); // Fills |args| with "user" and "error" arguments by querying |service|. static void GetArgsForGaiaLogin( diff --git a/chrome/browser/sync/sync_setup_wizard.cc b/chrome/browser/sync/sync_setup_wizard.cc index c879887..5a254dc 100644 --- a/chrome/browser/sync/sync_setup_wizard.cc +++ b/chrome/browser/sync/sync_setup_wizard.cc @@ -195,7 +195,8 @@ std::string SyncResourcesSource::GetLocalizedUrl( SyncSetupWizard::SyncSetupWizard(ProfileSyncService* service) : service_(service), - flow_container_(new SyncSetupFlowContainer()) { + flow_container_(new SyncSetupFlowContainer()), + parent_window_(NULL) { // Add our network layer data source for 'cloudy' URLs. SyncResourcesSource* sync_source = new SyncResourcesSource(); ChromeThread::PostTask( @@ -221,14 +222,16 @@ void SyncSetupWizard::Step(State advance_state) { // No flow is in progress, and we have never escorted the user all the // way through the wizard flow. flow_container_->set_flow( - SyncSetupFlow::Run(service_, flow_container_, advance_state, DONE)); + SyncSetupFlow::Run(service_, flow_container_, advance_state, DONE, + parent_window_)); } else { // No flow in in progress, but we've finished the wizard flow once before. // This is just a discrete run. if (IsTerminalState(advance_state)) return; // Nothing to do. flow_container_->set_flow(SyncSetupFlow::Run(service_, flow_container_, - advance_state, GetEndStateForDiscreteRun(advance_state))); + advance_state, GetEndStateForDiscreteRun(advance_state), + parent_window_)); } } @@ -252,6 +255,10 @@ void SyncSetupWizard::Focus() { } } +void SyncSetupWizard::SetParent(gfx::NativeWindow parent_window) { + parent_window_ = parent_window; +} + // static SyncSetupWizard::State SyncSetupWizard::GetEndStateForDiscreteRun( State start_state) { diff --git a/chrome/browser/sync/sync_setup_wizard.h b/chrome/browser/sync/sync_setup_wizard.h index 55195bf..9bb0bb0 100644 --- a/chrome/browser/sync/sync_setup_wizard.h +++ b/chrome/browser/sync/sync_setup_wizard.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_SYNC_SYNC_SETUP_WIZARD_H_ #include "base/basictypes.h" +#include "gfx/native_widget_types.h" class SyncSetupFlowContainer; @@ -63,6 +64,8 @@ class SyncSetupWizard { // not visible. void Focus(); + void SetParent(gfx::NativeWindow parent_window); + private: // If we just need to pop open an individual dialog, say to collect // gaia credentials in the event of a steady-state auth failure, this is @@ -77,6 +80,8 @@ class SyncSetupWizard { SyncSetupFlowContainer* flow_container_; + gfx::NativeWindow parent_window_; + DISALLOW_COPY_AND_ASSIGN(SyncSetupWizard); }; diff --git a/chrome/browser/sync/sync_ui_util.cc b/chrome/browser/sync/sync_ui_util.cc index ce8e4f9..4e2422f 100644 --- a/chrome/browser/sync/sync_ui_util.cc +++ b/chrome/browser/sync/sync_ui_util.cc @@ -189,7 +189,7 @@ void OpenSyncMyBookmarksDialog( if (service->HasSyncSetupCompleted()) { ShowOptionsWindow(OPTIONS_PAGE_CONTENT, OPTIONS_GROUP_NONE, profile); } else { - service->EnableForUser(); + service->EnableForUser(NULL); ProfileSyncService::SyncEvent(code); } } diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 984744c..83bbfef 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -1188,7 +1188,7 @@ void BookmarkBarView::ButtonPressed(views::Button* sender, if (sender->tag() == kSyncErrorButtonTag) { DCHECK(sender == sync_error_button_); DCHECK(sync_service_ && !sync_service_->IsManaged()); - sync_service_->ShowLoginDialog(); + sync_service_->ShowLoginDialog(GetWindow()->GetNativeWindow()); return; } diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index bedbb0e..c750c5e 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -153,13 +153,13 @@ void ContentPageView::ButtonPressed( IDS_CONFIRM_STOP_SYNCING_DIALOG_HEIGHT_LINES))); return; } else { - sync_service_->EnableForUser(); + sync_service_->EnableForUser(GetWindow()->GetNativeWindow()); ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_OPTIONS); } } else if (sender == sync_customize_button_) { // sync_customize_button_ should be invisible if sync is not yet set up. DCHECK(sync_service_->HasSyncSetupCompleted()); - sync_service_->ShowChooseDataTypes(); + sync_service_->ShowChooseDataTypes(GetWindow()->GetNativeWindow()); } } @@ -172,7 +172,7 @@ void ContentPageView::LinkActivated(views::Link* source, int event_flags) { } if (source == sync_action_link_) { DCHECK(sync_service_ && !sync_service_->IsManaged()); - sync_service_->ShowLoginDialog(); + sync_service_->ShowLoginDialog(GetWindow()->GetNativeWindow()); return; } if (source == privacy_dashboard_link_) { |