diff options
author | mirandac@google.com <mirandac@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 22:37:42 +0000 |
---|---|---|
committer | mirandac@google.com <mirandac@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 22:37:42 +0000 |
commit | 6677024d9674022969241eb0d8e7584871e13eae (patch) | |
tree | a53c5a907f379266c4c09bfeb617d46500cc7e94 /chrome | |
parent | f4ef861ba773e66d1c6e7e023a38db32afdd531d (diff) | |
download | chromium_src-6677024d9674022969241eb0d8e7584871e13eae.zip chromium_src-6677024d9674022969241eb0d8e7584871e13eae.tar.gz chromium_src-6677024d9674022969241eb0d8e7584871e13eae.tar.bz2 |
Remove tips from NTP.
BUG= 50072
TEST= no tips on NTP.
Review URL: http://codereview.chromium.org/3033032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54045 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.cc | 5 | ||||
-rw-r--r-- | chrome/browser/profile.cc | 12 | ||||
-rw-r--r-- | chrome/browser/profile.h | 4 | ||||
-rw-r--r-- | chrome/browser/profile_manager.cc | 3 | ||||
-rw-r--r-- | chrome/browser/resources/new_new_tab.css | 33 | ||||
-rw-r--r-- | chrome/browser/resources/new_new_tab.html | 8 | ||||
-rw-r--r-- | chrome/browser/resources/new_new_tab.js | 64 |
7 files changed, 5 insertions, 124 deletions
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index 4bb445d..c033974 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -23,7 +23,6 @@ #include "chrome/browser/dom_ui/new_tab_page_sync_handler.h" #include "chrome/browser/dom_ui/ntp_resource_cache.h" #include "chrome/browser/dom_ui/shown_sections_handler.h" -#include "chrome/browser/dom_ui/tips_handler.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/pref_service.h" #include "chrome/browser/profile.h" @@ -463,8 +462,6 @@ NewTabUI::NewTabUI(TabContents* contents) AddMessageHandler((new MostVisitedHandler())->Attach(this)); AddMessageHandler((new RecentlyClosedTabsHandler())->Attach(this)); AddMessageHandler((new MetricsHandler())->Attach(this)); - if (WebResourcesEnabled()) - AddMessageHandler((new TipsHandler())->Attach(this)); if (GetProfile()->IsSyncAccessible()) AddMessageHandler((new NewTabPageSyncHandler())->Attach(this)); if (Extension::AppsAreEnabled()) { @@ -540,8 +537,6 @@ void NewTabUI::RegisterUserPrefs(PrefService* prefs) { MostVisitedHandler::RegisterUserPrefs(prefs); ShownSectionsHandler::RegisterUserPrefs(prefs); - if (NewTabUI::WebResourcesEnabled()) - TipsHandler::RegisterUserPrefs(prefs); UpdateUserPrefsVersion(prefs); } diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index af54776..98ad2863 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -639,10 +639,6 @@ class OffTheRecordProfileImpl : public Profile, NOTREACHED(); } - virtual void InitWebResources() { - NOTREACHED(); - } - virtual NTPResourceCache* GetNTPResourceCache() { // Just return the real profile resource cache. return profile_->GetNTPResourceCache(); @@ -896,14 +892,6 @@ void ProfileImpl::InitExtensions() { } } -void ProfileImpl::InitWebResources() { - if (web_resource_service_) - return; // Already initialized. - - web_resource_service_ = new WebResourceService(this); - web_resource_service_->StartAfterDelay(); -} - NTPResourceCache* ProfileImpl::GetNTPResourceCache() { if (!ntp_resource_cache_.get()) ntp_resource_cache_.reset(new NTPResourceCache(this)); diff --git a/chrome/browser/profile.h b/chrome/browser/profile.h index 9ad555b..9ed1c7a 100644 --- a/chrome/browser/profile.h +++ b/chrome/browser/profile.h @@ -412,9 +412,6 @@ class Profile { virtual void InitExtensions() = 0; - // Start up service that gathers data from web resource feeds. - virtual void InitWebResources() = 0; - // Returns the new tab page resource cache. virtual NTPResourceCache* GetNTPResourceCache() = 0; @@ -544,7 +541,6 @@ class ProfileImpl : public Profile, virtual BackgroundContentsService* GetBackgroundContentsService(); virtual void MarkAsCleanShutdown(); virtual void InitExtensions(); - virtual void InitWebResources(); virtual NTPResourceCache* GetNTPResourceCache(); virtual FilePath last_selected_directory(); virtual void set_last_selected_directory(const FilePath& path); diff --git a/chrome/browser/profile_manager.cc b/chrome/browser/profile_manager.cc index 8770b1d..383dd5e 100644 --- a/chrome/browser/profile_manager.cc +++ b/chrome/browser/profile_manager.cc @@ -191,9 +191,6 @@ bool ProfileManager::AddProfile(Profile* profile, bool init_extensions) { profiles_.insert(profiles_.end(), profile); if (init_extensions) profile->InitExtensions(); - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - if (!command_line.HasSwitch(switches::kDisableWebResources)) - profile->InitWebResources(); return true; } diff --git a/chrome/browser/resources/new_new_tab.css b/chrome/browser/resources/new_new_tab.css index a201da6..bc04233 100644 --- a/chrome/browser/resources/new_new_tab.css +++ b/chrome/browser/resources/new_new_tab.css @@ -245,50 +245,25 @@ html[dir=rtl] .item { margin: 0 10px; } -#set-as-home-page { - display: none; - margin: 10px 0; - text-align: center; -} - #top-bar { display: -webkit-box; -webkit-box-align: center; min-height: 56px; } -#tip-line { - -webkit-box-flex: 1; - -webkit-transition: opacity .15s; - -webkit-user-select: text; - border: 0; - cursor: text; - display: block; /* Since we are reusing the section display logic we need - to override the display for hidden tips. */ - margin: 10px; - -webkit-margin-start: 50%; - text-align: end; -} - -.notification.hidden, -#tip-line.hidden, -.notification-shown #tip-line { +.notification.hidden { opacity: 0; pointer-events: none; } -#tip-line a, -#tip-line button { - /* We do not want a trailing single word from a link on the last line */ - white-space: nowrap; -} - #option-button { -webkit-appearance: none; background-color: transparent; width: 19px; height: 17px; - margin: 0; + position: absolute; + right: 0; + top: 20px; border: 0; padding: 0; vertical-align: top; diff --git a/chrome/browser/resources/new_new_tab.html b/chrome/browser/resources/new_new_tab.html index c3d7ef4..3064678 100644 --- a/chrome/browser/resources/new_new_tab.html +++ b/chrome/browser/resources/new_new_tab.html @@ -44,14 +44,11 @@ function registerCallback(name) { chrome.send('getMostVisited'); chrome.send('getRecentlyClosedTabs'); -chrome.send('getTips'); chrome.send('getApps'); registerCallback('mostVisitedPages'); registerCallback('recentlyClosedTabs'); registerCallback('syncMessageChanged'); -registerCallback('tips'); -registerCallback('onHomePageSet'); registerCallback('getAppsCallback'); registerCallback('setShownSections'); @@ -72,7 +69,7 @@ var Section = { THUMB: 1, // LIST is no longer used RECENT: 4, - TIPS: 8, + // TIPS is no longer used SYNC: 16, DEBUG: 32 }; @@ -129,13 +126,11 @@ if ('mode' in hashParams) { <div id="main"> <div id=top-bar> - <div id="tip-line" class="section" section="TIPS"></div> <input type="button" id="option-button" i18n-values="title:pagedisplaytooltip"> </div> <menu id="option-menu"> - <div command="hide" section="TIPS" i18n-content="tips"></div> <div command="hide" section="THUMB" i18n-content="mostvisited"></div> <div command="hide" section="RECENT" i18n-content="recentlyclosed"></div> <hr> @@ -178,7 +173,6 @@ if ('mode' in hashParams) { </div> <script> - updateSimpleSection('tip-line', Section.TIPS); updateSimpleSection('recently-closed', Section.RECENT); updateSimpleSection('most-visited-section', Section.THUMB); updateSimpleSection('debug', Section.DEBUG); diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js index 5728d58..b9404a6 100644 --- a/chrome/browser/resources/new_new_tab.js +++ b/chrome/browser/resources/new_new_tab.js @@ -11,48 +11,6 @@ function updateSimpleSection(id, section) { $(id).classList.add('hidden'); } -var tipCache = {}; - -function tips(data) { - logEvent('received tips'); - tipCache = data; - renderTip(); -} - -function createTip(data) { - if (data.length) { - if (data[0].set_homepage_tip) { - var homepageButton = document.createElement('button'); - homepageButton.className = 'link'; - homepageButton.textContent = data[0].set_homepage_tip; - homepageButton.addEventListener('click', setAsHomePageLinkClicked); - return homepageButton; - } else { - try { - return parseHtmlSubset(data[0].tip_html_text); - } catch (parseErr) { - console.error('Error parsing tips: ' + parseErr.message); - } - } - } - // Return an empty DF in case of failure. - return document.createDocumentFragment(); -} - -function clearTipLine() { - var tipElement = $('tip-line'); - // There should always be only one tip. - tipElement.textContent = ''; - tipElement.removeEventListener('click', setAsHomePageLinkClicked); -} - -function renderTip() { - clearTipLine(); - var tipElement = $('tip-line'); - tipElement.appendChild(createTip(tipCache)); - fixLinkUnderlines(tipElement); -} - function recentlyClosedTabs(data) { logEvent('received recently closed tabs'); // We need to store the recent items so we can update the layout on a resize. @@ -847,17 +805,6 @@ function callGetSyncMessageIfSyncIsPresent() { } } -function setAsHomePageLinkClicked(e) { - chrome.send('setHomePage'); - e.preventDefault(); -} - -function onHomePageSet(data) { - showNotification(data[0], data[1]); - // Removes the "make this my home page" tip. - clearTipLine(); -} - function hideAllMenus() { optionMenu.hide(); } @@ -937,14 +884,3 @@ function mostVisitedPages(data, firstRun) { showFirstRunNotification(); } } - -// Log clicked links from the tips section. -document.addEventListener('click', function(e) { - var tipLinks = document.querySelectorAll('#tip-line a'); - for (var i = 0, tipLink; tipLink = tipLinks[i]; i++) { - if (tipLink.contains(e.target)) { - chrome.send('metrics', ['NTPTip_' + tipLink.href]); - break; - } - } -}); |