diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-20 18:08:16 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-20 18:08:16 +0000 |
commit | ca38d8e05b6cbd729487c6ed619117ae7510e4c6 (patch) | |
tree | 7eb25a06ec77a3d590bcbe85a690d3e84a9e6bd8 /chrome | |
parent | a8c72ad420e48ee14106cc61340a3ce6064a3c2d (diff) | |
download | chromium_src-ca38d8e05b6cbd729487c6ed619117ae7510e4c6.zip chromium_src-ca38d8e05b6cbd729487c6ed619117ae7510e4c6.tar.gz chromium_src-ca38d8e05b6cbd729487c6ed619117ae7510e4c6.tar.bz2 |
Remove personalization.h/cc by putting things in final resting places
Review URL: http://codereview.chromium.org/173085
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23833 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
20 files changed, 140 insertions, 385 deletions
diff --git a/chrome/app/chrome_dll_resource.h b/chrome/app/chrome_dll_resource.h index 1502512..26cb51d 100644 --- a/chrome/app/chrome_dll_resource.h +++ b/chrome/app/chrome_dll_resource.h @@ -188,7 +188,7 @@ #define IDC_SPELLCHECK_LANGUAGES_FIRST 41006 #define IDC_SPELLCHECK_LANGUAGES_LAST 41106 #define IDC_CHECK_SPELLING_OF_THIS_FIELD 41107 -#define IDC_P13N_INFO 41108 +#define IDC_SYNC_BOOKMARKS 41108 // Next default values for new objects // #ifdef APSTUDIO_INVOKED diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 4d54c4d..d9d2996 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -53,7 +53,7 @@ #include "chrome/common/pref_service.h" #include "chrome/common/url_constants.h" #ifdef CHROME_PERSONALIZATION -#include "chrome/browser/sync/personalization.h" +#include "chrome/browser/sync/profile_sync_service.h" #endif #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -699,6 +699,7 @@ void Browser::UpdateCommandsForFullscreenMode(bool is_fullscreen) { command_updater_.UpdateCommandEnabled(IDC_REPORT_BUG, show_main_ui); command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, show_main_ui); command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); + command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, show_main_ui); command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); @@ -1181,6 +1182,22 @@ void Browser::OpenImportSettingsDialog() { window_->ShowImportDialog(); } +#ifdef CHROME_PERSONALIZATION +void Browser::OpenSyncMyBookmarksDialog() { + ProfileSyncService* service = profile_->GetProfileSyncService(); + // TODO(timsteele): Incognito has no sync service for the time being, + // so protect against this case. + if (!service) + return; + if (service->HasSyncSetupCompleted()) { + ShowOptionsWindow(OPTIONS_PAGE_CONTENT, OPTIONS_GROUP_NONE, profile_); + } else { + service->EnableForUser(); + ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_WRENCH); + } +} +#endif + void Browser::OpenAboutChromeDialog() { UserMetrics::RecordAction(L"AboutChrome", profile_); window_->ShowAboutChromeDialog(); @@ -1398,11 +1415,8 @@ void Browser::ExecuteCommandWithDisposition( case IDC_SHOW_BOOKMARK_MANAGER: OpenBookmarkManager(); break; case IDC_SHOW_HISTORY: ShowHistoryTab(); break; case IDC_SHOW_DOWNLOADS: ShowDownloadsTab(); break; -#if defined(OS_WIN) #ifdef CHROME_PERSONALIZATION - case IDC_P13N_INFO: - Personalization::HandleMenuItemClick(profile()); break; -#endif + case IDC_SYNC_BOOKMARKS: OpenSyncMyBookmarksDialog(); break; #endif case IDC_OPTIONS: OpenOptionsDialog(); break; case IDC_EDIT_SEARCH_ENGINES: OpenKeywordEditor(); break; diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index 0ea7629..be6af7e 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -381,6 +381,9 @@ class Browser : public TabStripModelDelegate, void OpenOptionsDialog(); void OpenKeywordEditor(); void OpenPasswordManager(); +#ifdef CHROME_PERSONALIZATION + void OpenSyncMyBookmarksDialog(); +#endif void OpenImportSettingsDialog(); void OpenAboutChromeDialog(); void OpenHelpTab(); diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 505f2b3..9db4260 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -11,6 +11,7 @@ #include "app/resource_bundle.h" #include "base/file_version_info.h" #include "base/histogram.h" +#include "base/path_service.h" #include "base/platform_thread.h" #include "base/stats_table.h" #include "base/string_piece.h" @@ -22,9 +23,11 @@ #include "chrome/browser/dom_ui/chrome_url_data_manager.h" #include "chrome/browser/memory_details.h" #include "chrome/browser/net/dns_global.h" +#include "chrome/browser/profile.h" +#include "chrome/browser/profile_manager.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/browser/sync/personalization.h" +#include "chrome/common/chrome_paths.h" #include "chrome/common/histogram_synchronizer.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/pref_names.h" @@ -47,6 +50,13 @@ #include "chrome/browser/views/about_network_dialog.h" #endif +#ifdef CHROME_PERSONALIZATION +#include "chrome/browser/sync/auth_error_state.h" +#include "chrome/browser/sync/profile_sync_service.h" +using sync_api::SyncManager; +#endif + + using base::Time; using base::TimeDelta; @@ -387,6 +397,100 @@ std::string AboutVersion() { version_html, &localized_strings); } +#ifdef CHROME_PERSONALIZATION +static void AddBoolSyncDetail(ListValue* details, const std::wstring& stat_name, + bool stat_value) { + DictionaryValue* val = new DictionaryValue; + val->SetString(L"stat_name", stat_name); + val->SetBoolean(L"stat_value", stat_value); + details->Append(val); +} + +static void AddIntSyncDetail(ListValue* details, const std::wstring& stat_name, + int64 stat_value) { + DictionaryValue* val = new DictionaryValue; + val->SetString(L"stat_name", stat_name); + val->SetString(L"stat_value", FormatNumber(stat_value)); + details->Append(val); +} + +static std::wstring MakeSyncAuthErrorText(AuthErrorState state) { + switch (state) { + case AUTH_ERROR_INVALID_GAIA_CREDENTIALS: + return L"INVALID_GAIA_CREDENTIALS"; + case AUTH_ERROR_USER_NOT_SIGNED_UP: + return L"USER_NOT_SIGNED_UP"; + case AUTH_ERROR_CONNECTION_FAILED: + return L"CONNECTION_FAILED"; + default: + return std::wstring(); + } +} + +std::string AboutSync() { + FilePath user_data_dir; + if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) + return std::string(); + ProfileManager* profile_manager = g_browser_process->profile_manager(); + Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); + ProfileSyncService* service = profile->GetProfileSyncService(); + + DictionaryValue strings; + if (!service || !service->HasSyncSetupCompleted()) { + strings.SetString(L"summary", L"SYNC DISABLED"); + } else { + SyncManager::Status full_status(service->QueryDetailedSyncStatus()); + + strings.SetString(L"summary", + ProfileSyncService::BuildSyncStatusSummaryText( + full_status.summary)); + + strings.Set(L"authenticated", + new FundamentalValue(full_status.authenticated)); + strings.SetString(L"auth_problem", + MakeSyncAuthErrorText(service->GetAuthErrorState())); + + strings.SetString(L"time_since_sync", service->GetLastSyncedTimeString()); + + ListValue* details = new ListValue(); + strings.Set(L"details", details); + AddBoolSyncDetail(details, L"Server Up", full_status.server_up); + AddBoolSyncDetail(details, L"Server Reachable", + full_status.server_reachable); + AddBoolSyncDetail(details, L"Server Broken", full_status.server_broken); + AddBoolSyncDetail(details, L"Notifications Enabled", + full_status.notifications_enabled); + AddIntSyncDetail(details, L"Notifications Received", + full_status.notifications_received); + AddIntSyncDetail(details, L"Notifications Sent", + full_status.notifications_sent); + AddIntSyncDetail(details, L"Unsynced Count", full_status.unsynced_count); + AddIntSyncDetail(details, L"Conflicting Count", + full_status.conflicting_count); + AddBoolSyncDetail(details, L"Syncing", full_status.syncing); + AddBoolSyncDetail(details, L"Syncer Paused", full_status.syncer_paused); + AddBoolSyncDetail(details, L"Initial Sync Ended", + full_status.initial_sync_ended); + AddBoolSyncDetail(details, L"Syncer Stuck", full_status.syncer_stuck); + AddIntSyncDetail(details, L"Updates Available", + full_status.updates_available); + AddIntSyncDetail(details, L"Updates Received", + full_status.updates_received); + AddBoolSyncDetail(details, L"Disk Full", full_status.disk_full); + AddBoolSyncDetail(details, L"Invalid Store", full_status.invalid_store); + AddIntSyncDetail(details, L"Max Consecutive Errors", + full_status.max_consecutive_errors); + } + + static const StringPiece sync_html( + ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_ABOUT_SYNC_HTML)); + + return jstemplate_builder::GetTemplateHtml( + sync_html, &strings , "t" /* template root node id */); +} +#endif + // AboutSource ----------------------------------------------------------------- AboutSource::AboutSource() @@ -440,7 +544,7 @@ void AboutSource::StartDataRequest(const std::string& path_raw, response = AboutTerms(); } else if (path == kSyncPath) { #ifdef CHROME_PERSONALIZATION - response = Personalization::AboutSync(); + response = AboutSync(); #endif } #if defined(OS_LINUX) diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index 385d5d7..b166f37 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd @@ -45,7 +45,6 @@ without changes to the corresponding grd file. mp6 --> <include name="IDR_GAIA_LOGIN_HTML" file="sync\resources\gaia_login.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_SYNC_SETUP_FLOW_HTML" file="sync\resources\setup_flow.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_MERGE_AND_SYNC_HTML" file="sync\resources\merge_and_sync.html" flattenhtml="true" type="BINDATA" /> - <include name="IDR_NEW_TAB_P13N_HTML" file="sync\resources\new_tab_personalization.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_BLACKLIST_HTML" file="resources\privacy_blacklist_block.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_BLACKLIST_IMAGE" file="resources\privacy_blacklist_block.png" type="BINDATA" /> </includes> diff --git a/chrome/browser/dom_ui/dom_ui_factory.cc b/chrome/browser/dom_ui/dom_ui_factory.cc index af214c6..8b5a1c2 100644 --- a/chrome/browser/dom_ui/dom_ui_factory.cc +++ b/chrome/browser/dom_ui/dom_ui_factory.cc @@ -16,9 +16,6 @@ #include "chrome/browser/profile.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/url_constants.h" -#ifdef CHROME_PERSONALIZATION -#include "chrome/browser/sync/personalization.h" -#endif #include "googleurl/src/gurl.h" // Backend for both querying for and creating new DOMUI objects. If you're just @@ -67,20 +64,18 @@ static bool CreateDOMUI(const GURL& url, TabContents* tab_contents, } #endif -#ifdef CHROME_PERSONALIZATION - if (Personalization::NeedsDOMUI(url)) { - if (new_ui) - *new_ui = new HtmlDialogUI(tab_contents); - return true; - } -#endif - // This will get called a lot to check all URLs, so do a quick check of other // schemes (gears was handled above) to filter out most URLs. if (!url.SchemeIs(chrome::kChromeInternalScheme) && !url.SchemeIs(chrome::kChromeUIScheme)) return false; + if (url.host() == chrome::kSyncResourcesHost) { + if (new_ui) + *new_ui = new HtmlDialogUI(tab_contents); + return true; + } + // Special case the new tab page. In older versions of Chrome, the new tab // page was hosted at chrome-internal:<blah>. This might be in people's saved // sessions or bookmarks, so we say any URL with that scheme triggers the new 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 d903f28..7b8fd39 100644 --- a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc +++ b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc @@ -11,7 +11,6 @@ #include "base/values.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/render_view_host.h" -#include "chrome/browser/sync/personalization.h" #include "chrome/browser/sync/personalization_strings.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/pref_names.h" diff --git a/chrome/browser/gtk/options/options_window_gtk.cc b/chrome/browser/gtk/options/options_window_gtk.cc index 8473b9d..28b9820 100644 --- a/chrome/browser/gtk/options/options_window_gtk.cc +++ b/chrome/browser/gtk/options/options_window_gtk.cc @@ -13,9 +13,6 @@ #include "chrome/browser/gtk/options/content_page_gtk.h" #include "chrome/browser/gtk/options/general_page_gtk.h" #include "chrome/browser/profile.h" -#ifdef CHROME_PERSONALIZATION -#include "chrome/browser/sync/personalization.h" -#endif #include "chrome/common/gtk_util.h" #include "chrome/common/pref_member.h" #include "chrome/common/pref_names.h" diff --git a/chrome/browser/sync/personalization.cc b/chrome/browser/sync/personalization.cc deleted file mode 100644 index 866149f..0000000 --- a/chrome/browser/sync/personalization.cc +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) 2006-2008 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. - -#ifdef CHROME_PERSONALIZATION - -#include "chrome/browser/sync/personalization.h" - -#include "app/resource_bundle.h" -#include "base/command_line.h" -#include "base/file_path.h" -#include "base/file_util.h" -#include "base/path_service.h" -#include "base/string_util.h" -#include "chrome/app/chrome_dll_resource.h" -#include "chrome/browser/browser.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/browser_url_handler.h" -#include "chrome/browser/command_updater.h" -#include "chrome/browser/dom_ui/new_tab_page_sync_handler.h" -#include "chrome/browser/options_window.h" -#include "chrome/browser/profile.h" -#include "chrome/browser/profile_manager.h" -#include "chrome/browser/sync/auth_error_state.h" -#include "chrome/browser/sync/personalization_strings.h" -#include "chrome/browser/sync/profile_sync_service.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/common/jstemplate_builder.h" -#include "chrome/common/notification_service.h" -#include "chrome/common/pref_service.h" -#include "chrome/common/url_constants.h" -#include "googleurl/src/gurl.h" -#include "grit/app_resources.h" -#include "grit/browser_resources.h" -#include "net/url_request/url_request.h" - -using sync_api::SyncManager; - -namespace Personalization { - -static std::wstring MakeAuthErrorText(AuthErrorState state) { - switch (state) { - case AUTH_ERROR_INVALID_GAIA_CREDENTIALS: - return L"INVALID_GAIA_CREDENTIALS"; - case AUTH_ERROR_USER_NOT_SIGNED_UP: - return L"USER_NOT_SIGNED_UP"; - case AUTH_ERROR_CONNECTION_FAILED: - return L"CONNECTION_FAILED"; - default: - return std::wstring(); - } -} - -bool NeedsDOMUI(const GURL& url) { - return url.SchemeIs(chrome::kChromeUIScheme) && - (url.path().find(chrome::kSyncGaiaLoginPath) != std::string::npos) || - (url.path().find(chrome::kSyncSetupFlowPath) != std::string::npos) || - (url.path().find(chrome::kSyncMergeAndSyncPath) != std::string::npos); -} - -DOMMessageHandler* CreateNewTabPageHandler(DOMUI* dom_ui) { - return (new NewTabPageSyncHandler())->Attach(dom_ui); -} - -std::string GetNewTabSource() { - static const StringPiece new_tab_html( - ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_NEW_TAB_P13N_HTML)); - - std::string data_uri("data:text/html,"); - data_uri.append(std::string(new_tab_html.data(), new_tab_html.size())); - return GURL(data_uri).spec(); -} - -std::wstring GetMenuItemInfoText(Browser* browser) { - browser->command_updater()->UpdateCommandEnabled(IDC_P13N_INFO, true); - return kMenuLabelStartSync; -} - -void HandleMenuItemClick(Profile* p) { - // The menu item is enabled either when the sync is not enabled by the user - // or when it's enabled but the user name is empty. In the former case enable - // sync. In the latter case, show the login dialog. - ProfileSyncService* service = p->GetProfileSyncService(); - if (!service) - return; // Incognito has no sync service (or TestingProfile, etc). - if (service->HasSyncSetupCompleted()) { - ShowOptionsWindow(OPTIONS_PAGE_CONTENT, OPTIONS_GROUP_NONE, p); - } else { - service->EnableForUser(); - ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_WRENCH); - } -} - -} // namespace Personalization - -namespace Personalization { - -static void AddBoolDetail(ListValue* details, const std::wstring& stat_name, - bool stat_value) { - DictionaryValue* val = new DictionaryValue; - val->SetString(L"stat_name", stat_name); - val->SetBoolean(L"stat_value", stat_value); - details->Append(val); -} - -static void AddIntDetail(ListValue* details, const std::wstring& stat_name, - int64 stat_value) { - DictionaryValue* val = new DictionaryValue; - val->SetString(L"stat_name", stat_name); - val->SetString(L"stat_value", FormatNumber(stat_value)); - details->Append(val); -} - -std::string AboutSync() { - FilePath user_data_dir; - if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) - return std::string(); - ProfileManager* profile_manager = g_browser_process->profile_manager(); - Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); - ProfileSyncService* service = profile->GetProfileSyncService(); - - DictionaryValue strings; - if (!service || !service->HasSyncSetupCompleted()) { - strings.SetString(L"summary", L"SYNC DISABLED"); - } else { - SyncManager::Status full_status(service->QueryDetailedSyncStatus()); - - strings.SetString(L"summary", - ProfileSyncService::BuildSyncStatusSummaryText( - full_status.summary)); - - strings.Set(L"authenticated", - new FundamentalValue(full_status.authenticated)); - strings.SetString(L"auth_problem", - MakeAuthErrorText(service->GetAuthErrorState())); - - strings.SetString(L"time_since_sync", service->GetLastSyncedTimeString()); - - ListValue* details = new ListValue(); - strings.Set(L"details", details); - AddBoolDetail(details, L"Server Up", full_status.server_up); - AddBoolDetail(details, L"Server Reachable", full_status.server_reachable); - AddBoolDetail(details, L"Server Broken", full_status.server_broken); - AddBoolDetail(details, L"Notifications Enabled", - full_status.notifications_enabled); - AddIntDetail(details, L"Notifications Received", - full_status.notifications_received); - AddIntDetail(details, L"Notifications Sent", - full_status.notifications_sent); - AddIntDetail(details, L"Unsynced Count", full_status.unsynced_count); - AddIntDetail(details, L"Conflicting Count", full_status.conflicting_count); - AddBoolDetail(details, L"Syncing", full_status.syncing); - AddBoolDetail(details, L"Syncer Paused", full_status.syncer_paused); - AddBoolDetail(details, L"Initial Sync Ended", - full_status.initial_sync_ended); - AddBoolDetail(details, L"Syncer Stuck", full_status.syncer_stuck); - AddIntDetail(details, L"Updates Available", full_status.updates_available); - AddIntDetail(details, L"Updates Received", full_status.updates_received); - AddBoolDetail(details, L"Disk Full", full_status.disk_full); - AddBoolDetail(details, L"Invalid Store", full_status.invalid_store); - AddIntDetail(details, L"Max Consecutive Errors", - full_status.max_consecutive_errors); - } - - static const StringPiece sync_html( - ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_ABOUT_SYNC_HTML)); - - return jstemplate_builder::GetTemplateHtml( - sync_html, &strings , "t" /* template root node id */); -} - -} // namespace Personalization - -#endif // CHROME_PERSONALIZATION diff --git a/chrome/browser/sync/personalization.h b/chrome/browser/sync/personalization.h deleted file mode 100644 index fb6a4ed..0000000 --- a/chrome/browser/sync/personalization.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2006-2008 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. - -#ifdef CHROME_PERSONALIZATION - -// TODO(timsteele): Remove this file by finding proper homes for everything in -// trunk. -#ifndef CHROME_BROWSER_SYNC_PERSONALIZATION_H_ -#define CHROME_BROWSER_SYNC_PERSONALIZATION_H_ - -#include <string> -#include "base/basictypes.h" -#include "chrome/browser/dom_ui/chrome_url_data_manager.h" - -class Browser; -class DOMUI; -class DOMMessageHandler; -class Profile; -class RenderView; -class RenderViewHost; -class WebFrame; -class WebView; - -class ProfileSyncService; -class ProfileSyncServiceObserver; - -namespace views { class View; } - -// Contains methods to perform Personalization-related tasks on behalf of the -// caller. -namespace Personalization { - -// Returns whether |url| should be loaded in a DOMUI. -bool NeedsDOMUI(const GURL& url); - -// Handler for "about:sync" -std::string AboutSync(); - -// Construct a new DOMMessageHandler for the new tab page |dom_ui|. -DOMMessageHandler* CreateNewTabPageHandler(DOMUI* dom_ui); - -// Get HTML for the Personalization iframe in the New Tab Page. -std::string GetNewTabSource(); - -// Returns the text for personalization info menu item and sets its enabled -// state. -std::wstring GetMenuItemInfoText(Browser* browser); - -// Performs appropriate action when the sync menu item is clicked. -void HandleMenuItemClick(Profile* p); -} // namespace Personalization - -#endif // CHROME_BROWSER_SYNC_PERSONALIZATION_H_ -#endif // CHROME_PERSONALIZATION diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index a426e53..0690273 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -22,7 +22,6 @@ #include "chrome/browser/history/history_types.h" #include "chrome/browser/profile.h" #include "chrome/browser/sync/engine/syncapi.h" -#include "chrome/browser/sync/personalization.h" #include "chrome/browser/sync/personalization_strings.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/notification_service.h" diff --git a/chrome/browser/sync/resources/new_tab_personalization.html b/chrome/browser/sync/resources/new_tab_personalization.html deleted file mode 100644 index 73cf346..0000000 --- a/chrome/browser/sync/resources/new_tab_personalization.html +++ /dev/null @@ -1,117 +0,0 @@ -<html> -<head> -<style type="text/css"> -body { - font-family:arial; - background-color:white; - font-size:80%; - margin:0px; -} -.section-title { - color:#000; - line-height:19pt; - font-size:95%; - font-weight:bold; - margin-bottom:4px; - margin-left: 0px; -} -a { - color:#0000cc; - white-space: nowrap; -} -.sidebar { - width: 207px; - padding:3px 10px 3px 9px; - -webkit-border-radius:5px 5px; - margin-bottom:10px; -} -</style> -<script> -function resizeFrame(newsize) { - chrome.send("ResizeP13N", [newsize.toString()]); -} -</script> -</head> -<body> -<div id="sync" class="sidebar"> - <table id="titletable" width="200" cellpadding="0" cellspacing="0" - style="display:none"> - <tr> - <td id="messagetitle" align="left" class="section-title"> - </td> - <td align="right"> - <a href="#" onclick="resizeFrame(0);"> - <img id="greenclose" src="close.png"/> - </a> - </td> - </tr> - </table> - <div id="syncContainer"></div> -</div> -<script> -/* Return a DOM element with tag name |elem| and attributes |attrs|. */ -function DOM(elem, attrs) { - var elem = document.createElement(elem); - for (var attr in attrs) { - elem[attr] = attrs[attr]; - } - return elem; -} - -function renderSyncMessage(message) { - var section = document.getElementById('sync'); - var container = document.getElementById('syncContainer'); - var title = document.getElementById('messagetitle'); - var titletable = document.getElementById('titletable'); - container.innerHTML = ''; - title.innerHTML = ''; - titletable.style.display = "none"; - section.style.display = "block"; - - /* Set the sync section background color. */ - if (message.msgtype == "error") { - section.style.backgroundColor = "#f8d1ca"; - } else if (message.msgtype == "presynced") { - section.style.backgroundColor = "#e0f8ca"; - } else { - section.style.backgroundColor = "#e1ecfe"; - } - - if (message.msgtype != "synced") { - /* Any message except the status normal / synced to - message requires extra markup for a title, close button, - and links. */ - var titletxt = document.createTextNode(message.title); - title.appendChild(titletxt); - titletable.style.display = "block"; - } - - /* The main message of the sync section. */ - var txt = DOM('p'); - txt.style.margin = 0; - txt.appendChild(document.createTextNode(message.msg)); - container.appendChild(txt); - - /* If we should show a link, create the href. */ - if (message.linktext) { - var link = DOM('a', { href:"#", title: message.linktext}); - link.onclick = function(tt) { - return function() { - chrome.send("SyncLinkClicked", [tt]); - return false; - } - } (message.title); - - /* Tie it together. */ - link.appendChild(document.createTextNode(message.linktext)); - container.appendChild(link); - } - - /* Tell our container to resize to fit us appropriately. */ - resizeFrame(document.body.scrollHeight); -} - -chrome.send("GetSyncMessage"); -</script> -</body> -</html>
\ No newline at end of file diff --git a/chrome/browser/views/sync/sync_setup_wizard.cc b/chrome/browser/views/sync/sync_setup_wizard.cc index 2e86bfd..0421e4e 100644 --- a/chrome/browser/views/sync/sync_setup_wizard.cc +++ b/chrome/browser/views/sync/sync_setup_wizard.cc @@ -21,7 +21,7 @@ class SyncResourcesSource : public ChromeURLDataManager::DataSource { public: SyncResourcesSource() - : DataSource(chrome::kSyncResourcesPath, MessageLoop::current()) { + : DataSource(chrome::kSyncResourcesHost, MessageLoop::current()) { } virtual ~SyncResourcesSource() { } diff --git a/chrome/browser/views/sync/sync_setup_wizard_unittest.cc b/chrome/browser/views/sync/sync_setup_wizard_unittest.cc index 88dae75..c327ca0 100644 --- a/chrome/browser/views/sync/sync_setup_wizard_unittest.cc +++ b/chrome/browser/views/sync/sync_setup_wizard_unittest.cc @@ -10,7 +10,6 @@ #include "base/stl_util-inl.h" #include "chrome/browser/browser.h" #include "chrome/browser/browser_list.h" -#include "chrome/browser/sync/personalization.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/views/sync/sync_setup_flow.h" #include "chrome/browser/views/sync/sync_setup_wizard.h" diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 6d0b8cf..f7c3518 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -40,7 +40,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #ifdef CHROME_PERSONALIZATION -#include "chrome/browser/sync/personalization.h" +#include "chrome/browser/sync/personalization_strings.h" #endif #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -1086,8 +1086,7 @@ void ToolbarView::CreateAppMenu() { app_menu_contents_->AddSeparator(); #ifdef CHROME_PERSONALIZATION if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableSync)) { - app_menu_contents_->AddItem(IDC_P13N_INFO, - Personalization::GetMenuItemInfoText(browser())); + app_menu_contents_->AddItem(IDC_SYNC_BOOKMARKS, kMenuLabelStartSync); } #endif app_menu_contents_->AddItemWithStringId(IDC_CLEAR_BROWSING_DATA, diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index f699624..9b7b71e 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -1704,8 +1704,6 @@ 'browser/sync/glue/model_associator.h', 'browser/sync/glue/sync_backend_host.cc', 'browser/sync/glue/sync_backend_host.h', - 'browser/sync/personalization.cc', - 'browser/sync/personalization.h', 'browser/sync/personalization_strings.h', 'browser/sync/profile_sync_service.cc', 'browser/sync/profile_sync_service.h', diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 65b87ae..03d048f 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc @@ -55,7 +55,7 @@ const char kChromeUINewTabHost[] = "newtab"; const char kChromeUIThumbnailPath[] = "thumb"; const char kChromeUIThemePath[] = "theme"; -const char kSyncResourcesPath[] = "syncresources"; +const char kSyncResourcesHost[] = "syncresources"; const char kSyncGaiaLoginPath[] = "gaialogin"; const char kSyncMergeAndSyncPath[] = "mergeandsync"; const char kSyncThrobberPath[] = "throbber.png"; diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index 4b33679..5917aaa 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h @@ -63,7 +63,7 @@ extern const char kChromeUIThumbnailPath[]; extern const char kChromeUIThemePath[]; // Sync related URL components. -extern const char kSyncResourcesPath[]; +extern const char kSyncResourcesHost[]; extern const char kSyncGaiaLoginPath[]; extern const char kSyncMergeAndSyncPath[]; extern const char kSyncThrobberPath[]; diff --git a/chrome/test/live_sync/live_bookmarks_sync_test.h b/chrome/test/live_sync/live_bookmarks_sync_test.h index c9a00e0..316ffd7 100644 --- a/chrome/test/live_sync/live_bookmarks_sync_test.h +++ b/chrome/test/live_sync/live_bookmarks_sync_test.h @@ -12,7 +12,6 @@ #include "base/command_line.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" -#include "chrome/browser/sync/personalization.h" #include "chrome/test/in_process_browser_test.h" #include "googleurl/src/gurl.h" diff --git a/chrome/test/live_sync/single_client_live_bookmarks_sync_unittest.cc b/chrome/test/live_sync/single_client_live_bookmarks_sync_unittest.cc index 006b93e..ca2263d 100644 --- a/chrome/test/live_sync/single_client_live_bookmarks_sync_unittest.cc +++ b/chrome/test/live_sync/single_client_live_bookmarks_sync_unittest.cc @@ -8,7 +8,6 @@ #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/browser.h" #include "chrome/browser/profile.h" -#include "chrome/browser/sync/personalization.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/test/live_sync/bookmark_model_verifier.h" #include "chrome/test/live_sync/profile_sync_service_test_harness.h" |