diff options
author | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-18 20:40:25 +0000 |
---|---|---|
committer | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-18 20:40:25 +0000 |
commit | c44a9d4aaff54ab651c380c134a950769e9e3898 (patch) | |
tree | 97a40eba5a94017c32be2292fa65f7f5066226f8 /chrome | |
parent | fac63935827a5cdc34bea6e0c72ecde405e703a9 (diff) | |
download | chromium_src-c44a9d4aaff54ab651c380c134a950769e9e3898.zip chromium_src-c44a9d4aaff54ab651c380c134a950769e9e3898.tar.gz chromium_src-c44a9d4aaff54ab651c380c134a950769e9e3898.tar.bz2 |
Change the sync dialog to use the Html version on Linux.
BUG=none
TEST=Run chrome with --enable-sync. While bookmark sync is disabled, click on Wrench Menu->Sync My Bookmarks
Review URL: http://codereview.chromium.org/402059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32389 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/gtk/sync_setup_wizard_gtk.cc | 128 | ||||
-rw-r--r-- | chrome/browser/gtk/sync_setup_wizard_gtk.h | 56 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard.h | 13 | ||||
-rwxr-xr-x | chrome/chrome.gyp | 9 |
4 files changed, 0 insertions, 206 deletions
diff --git a/chrome/browser/gtk/sync_setup_wizard_gtk.cc b/chrome/browser/gtk/sync_setup_wizard_gtk.cc deleted file mode 100644 index 7053520..0000000 --- a/chrome/browser/gtk/sync_setup_wizard_gtk.cc +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) 2009 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/gtk/sync_setup_wizard_gtk.h" - -#include "chrome/browser/browser_list.h" -#include "chrome/browser/browser_window.h" -#include "chrome/browser/sync/profile_sync_service.h" -#include "chrome/browser/sync/sync_setup_wizard.h" -#include "chrome/common/gtk_util.h" - -// SyncSetupWizard ------------------------------------------------------------- - -SyncSetupWizard::SyncSetupWizard(ProfileSyncService* service) - : service_(service), - visible_(false) { -} - -SyncSetupWizard::~SyncSetupWizard() { -} - -void SyncSetupWizard::Step(State advance_state) { - switch (advance_state) { - case GAIA_LOGIN: - SyncSetupWizardGtk::Show(service_, this); - break; - case GAIA_SUCCESS: - case MERGE_AND_SYNC: - case FATAL_ERROR: - case DONE: - case DONE_FIRST_TIME: - // TODO(zork): Implement - break; - default: - NOTREACHED(); - } -} - -bool SyncSetupWizard::IsVisible() const { - return visible_; -} - -// SyncSetupWizardGtk ---------------------------------------------------------- - -// static -void SyncSetupWizardGtk::Show(ProfileSyncService* service, - SyncSetupWizard *wizard) { - Browser* b = BrowserList::GetLastActive(); - wizard->set_visible(true); - new SyncSetupWizardGtk(b->window()->GetNativeHandle(), service, wizard); -} - -SyncSetupWizardGtk::SyncSetupWizardGtk(GtkWindow* parent, - ProfileSyncService* service, - SyncSetupWizard *wizard) - : username_textbox_(NULL), - password_textbox_(NULL), - service_(service), - wizard_(wizard) { - // TODO(zork): Put in proper localized strings. - // - // Build the dialog. - GtkWidget* dialog = gtk_dialog_new_with_buttons( - "Setting up Bookmarks Sync", - parent, - (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), - GTK_STOCK_CANCEL, - GTK_RESPONSE_REJECT, - NULL); - gtk_util::AddButtonToDialog(dialog, - "Accept", - GTK_STOCK_APPLY, GTK_RESPONSE_ACCEPT); - - GtkWidget* content_area = GTK_DIALOG(dialog)->vbox; - gtk_box_set_spacing(GTK_BOX(content_area), gtk_util::kContentAreaSpacing); - - GtkWidget* vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); - gtk_container_add(GTK_CONTAINER(content_area), vbox); - - // Description. - GtkWidget* description = gtk_label_new( - "Google Chrome can store your bookmark data with your Google account.\n" - "Bookmarks that you create on this computer will instantly be made\n" - "available on all the computers synced to this account.\n"); - gtk_misc_set_alignment(GTK_MISC(description), 0, 0); - gtk_container_add(GTK_CONTAINER(content_area), description); - - // Label on top of the username. - GtkWidget* email = gtk_label_new("Email:"); - gtk_misc_set_alignment(GTK_MISC(email), 0, 0); - gtk_container_add(GTK_CONTAINER(content_area), email); - - // Username text box - username_textbox_= gtk_entry_new(); - gtk_container_add(GTK_CONTAINER(content_area), username_textbox_); - - // Label on top of the password. - GtkWidget* password = gtk_label_new("Password:"); - gtk_misc_set_alignment(GTK_MISC(password), 0, 0); - gtk_container_add(GTK_CONTAINER(content_area), password); - - // Password text box - password_textbox_= gtk_entry_new(); - gtk_entry_set_visibility(GTK_ENTRY(password_textbox_), FALSE); - gtk_container_add(GTK_CONTAINER(content_area), password_textbox_); - - g_signal_connect(dialog, "response", - G_CALLBACK(HandleOnResponseDialog), this); - gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); - gtk_widget_show_all(dialog); -} - -void SyncSetupWizardGtk::OnDialogResponse(GtkWidget* widget, int response) { - wizard_->set_visible(false); - if (response == GTK_RESPONSE_ACCEPT) { - service_->OnUserSubmittedAuth( - gtk_entry_get_text(GTK_ENTRY(username_textbox_)), - gtk_entry_get_text(GTK_ENTRY(password_textbox_)), - std::string()); - - service_->SetSyncSetupCompleted(); - } - service_->OnUserCancelledDialog(); - - delete this; - gtk_widget_destroy(GTK_WIDGET(widget)); -} diff --git a/chrome/browser/gtk/sync_setup_wizard_gtk.h b/chrome/browser/gtk/sync_setup_wizard_gtk.h deleted file mode 100644 index 6a5dbc7..0000000 --- a/chrome/browser/gtk/sync_setup_wizard_gtk.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2009 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_GTK_SYNC_SETUP_WIZARD_GTK_H_ -#define CHROME_BROWSER_GTK_SYNC_SETUP_WIZARD_GTK_H_ - -#include <gtk/gtk.h> - -#include "base/basictypes.h" -#include "base/string16.h" -#include "googleurl/src/gurl.h" - -typedef struct _GtkWidget GtkWidget; -typedef struct _GtkWindow GtkWindow; - -class ProfileSyncService; - -class SyncSetupWizard; - -// This class is used as a temporary solution to allow login to bookmark sync on -// Linux. It will be replaced with the HtmlDialog based solution when -// window->ShowHtmlDialog() is implemented on Linux. -// See: http://code.google.com/p/chromium/issues/detail?id=25260 - -class SyncSetupWizardGtk { - public: - // Displays the dialog box to setup sync. - static void Show(ProfileSyncService* service, - SyncSetupWizard *wizard); - - private: - SyncSetupWizardGtk(GtkWindow* parent, ProfileSyncService* service, - SyncSetupWizard *wizard); - ~SyncSetupWizardGtk() { } - - // Handler to respond to Ok and Cancel responses from the dialog. - static void HandleOnResponseDialog(GtkWidget* widget, - int response, SyncSetupWizardGtk* setup_wizard) { - setup_wizard->OnDialogResponse(widget, response); - } - - void OnDialogResponse(GtkWidget* widget, int response); - - // UI elements. - GtkWidget* username_textbox_; - GtkWidget* password_textbox_; - - // We need this to write the sentinel "setup completed" pref. - ProfileSyncService* service_; - SyncSetupWizard* wizard_; - - DISALLOW_COPY_AND_ASSIGN(SyncSetupWizardGtk); -}; - -#endif // CHROME_BROWSER_GTK_SYNC_SETUP_WIZARD_GTK_H_ diff --git a/chrome/browser/sync/sync_setup_wizard.h b/chrome/browser/sync/sync_setup_wizard.h index 7367b6c..685b5f0 100644 --- a/chrome/browser/sync/sync_setup_wizard.h +++ b/chrome/browser/sync/sync_setup_wizard.h @@ -7,12 +7,7 @@ #include "base/basictypes.h" -#if defined(TOOLKIT_GTK) -typedef struct _GtkWidget GtkWidget; -typedef struct _GtkWindow GtkWindow; -#else class SyncSetupFlowContainer; -#endif class ProfileSyncService; @@ -53,10 +48,6 @@ class SyncSetupWizard { // if various buttons in the UI should be enabled or disabled. bool IsVisible() const; -#if defined(TOOLKIT_GTK) - void set_visible(bool visible) { visible_ = visible; } -#endif - 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 @@ -69,14 +60,10 @@ class SyncSetupWizard { ProfileSyncService* service_; -#if defined(TOOLKIT_GTK) - bool visible_; -#else // The use of ShowHtmlDialog and SyncSetupFlowContainer is disabled on Linux // until BrowserShowHtmlDialog() is implemented. // See: http://code.google.com/p/chromium/issues/detail?id=25260 SyncSetupFlowContainer* flow_container_; -#endif DISALLOW_COPY_AND_ASSIGN(SyncSetupWizard); }; diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 048d50a..3a77f44 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -3010,8 +3010,6 @@ 'sources/': [ ['include', '^browser/printing/print_dialog_gtk.cc'], ['include', '^browser/printing/print_dialog_gtk.h'], - ['exclude', '^browser/sync/sync_setup_flow.cc'], - ['exclude', '^browser/sync/sync_setup_wizard.cc'], ], }], ['chromeos==1 or toolkit_views==1',{ @@ -3111,12 +3109,6 @@ '../third_party/WebKit/WebCore/WebCore.gyp/WebCore.gyp:webcore', ], }], - ['OS=="linux"', { - 'sources': [ - 'browser/gtk/sync_setup_wizard_gtk.cc', - 'browser/gtk/sync_setup_wizard_gtk.h', - ], - }], ], }, { @@ -4863,7 +4855,6 @@ 'browser/renderer_host/gtk_key_bindings_handler_unittest.cc', ], 'sources!': [ - 'browser/sync/sync_setup_wizard_unittest.cc', 'browser/views/bookmark_context_menu_test.cc', 'browser/gtk/options/cookies_view_unittest.cc', # Compact Language Detection (cld) is not supported in linux yet. |