summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-19 18:37:21 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-19 18:37:21 +0000
commitd8c6cabdea33f84a488f529bb027491739b2fb6e (patch)
tree8207fe14c048bbf22024dab8f208525602dacd67 /chrome
parentb0ae9ea4ee49d8585a3886777ffa2957bb5e830a (diff)
downloadchromium_src-d8c6cabdea33f84a488f529bb027491739b2fb6e.zip
chromium_src-d8c6cabdea33f84a488f529bb027491739b2fb6e.tar.gz
chromium_src-d8c6cabdea33f84a488f529bb027491739b2fb6e.tar.bz2
Remove web store icon from most visited per Glen.
BUG=52669 Review URL: http://codereview.chromium.org/3140018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56721 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/dom_ui/most_visited_handler.cc67
-rw-r--r--chrome/browser/dom_ui/most_visited_handler.h8
-rw-r--r--chrome/browser/history/top_sites.cc62
-rw-r--r--chrome/browser/history/top_sites.h9
-rw-r--r--chrome/browser/history/top_sites_unittest.cc48
5 files changed, 0 insertions, 194 deletions
diff --git a/chrome/browser/dom_ui/most_visited_handler.cc b/chrome/browser/dom_ui/most_visited_handler.cc
index 11bb51b..33f3ec6 100644
--- a/chrome/browser/dom_ui/most_visited_handler.cc
+++ b/chrome/browser/dom_ui/most_visited_handler.cc
@@ -22,8 +22,6 @@
#include "chrome/browser/dom_ui/dom_ui_favicon_source.h"
#include "chrome/browser/dom_ui/dom_ui_thumbnail_source.h"
#include "chrome/browser/dom_ui/new_tab_ui.h"
-#include "chrome/browser/extensions/extensions_service.h"
-#include "chrome/browser/google_util.h"
#include "chrome/browser/history/page_usage_data.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/top_sites.h"
@@ -31,7 +29,6 @@
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/extensions/extension.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/notification_source.h"
#include "chrome/common/pref_names.h"
@@ -392,9 +389,6 @@ void MostVisitedHandler::SetPagesValue(std::vector<PageUsageData*>* data) {
size_t pre_populated_index = 0;
const std::vector<MostVisitedPage> pre_populated_pages =
MostVisitedHandler::GetPrePopulatedPages();
- bool add_chrome_store =
- !CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableApps) &&
- !HasApps();
while (output_index < kMostVisitedPages) {
bool found = false;
@@ -432,16 +426,6 @@ void MostVisitedHandler::SetPagesValue(std::vector<PageUsageData*>* data) {
found = true;
}
- if (!found && add_chrome_store) {
- mvp = GetChromeStorePage();
- std::string key = GetDictionaryKeyForURL(mvp.url.spec());
- if (!pinned_urls_->HasKey(key) && !url_blacklist_->HasKey(key) &&
- seen_urls.find(mvp.url) == seen_urls.end()) {
- found = true;
- }
- add_chrome_store = false;
- }
-
if (found) {
// Add fillers as needed.
while (pages_value_->GetSize() < output_index) {
@@ -459,30 +443,6 @@ void MostVisitedHandler::SetPagesValue(std::vector<PageUsageData*>* data) {
}
output_index++;
}
-
- // If we still need to show the Chrome Store go backwards until we find a non
- // pinned item we can replace.
- if (add_chrome_store) {
- MostVisitedPage chrome_store_page = GetChromeStorePage();
- if (seen_urls.find(chrome_store_page.url) != seen_urls.end())
- return;
-
- std::string key = GetDictionaryKeyForURL(chrome_store_page.url.spec());
- if (url_blacklist_->HasKey(key))
- return;
-
- for (int i = kMostVisitedPages - 1; i >= 0; --i) {
- GURL url = most_visited_urls_[i];
- std::string key = GetDictionaryKeyForURL(url.spec());
- if (!pinned_urls_->HasKey(key)) {
- // Not pinned, replace.
- DictionaryValue* page_value = new DictionaryValue();
- SetMostVisistedPage(page_value, chrome_store_page);
- pages_value_->Set(i, page_value);
- return;
- }
- }
- }
}
void MostVisitedHandler::SetPagesValueFromTopSites(
@@ -512,9 +472,6 @@ void MostVisitedHandler::SetPagesValueFromTopSites(
l10n_util::GetStringUTF8(IDS_THEMES_GALLERY_URL)) {
page_value->SetString("thumbnailUrl",
"chrome://theme/IDR_NEWTAB_THEMES_GALLERY_THUMBNAIL");
- } else if (url.url == GetChromeStoreURLWithLocale()) {
- page_value->SetString("thumbnailUrl",
- "chrome://theme/IDR_NEWTAB_CHROME_STORE_PAGE_THUMBNAIL");
}
history::TopSites* ts = dom_ui_->GetProfile()->GetTopSites();
@@ -579,22 +536,6 @@ const std::vector<MostVisitedHandler::MostVisitedPage>&
return pages;
}
-// static
-MostVisitedHandler::MostVisitedPage MostVisitedHandler::GetChromeStorePage() {
- MostVisitedHandler::MostVisitedPage page = {
- l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE),
- GetChromeStoreURLWithLocale(),
- GURL("chrome://theme/IDR_NEWTAB_CHROME_STORE_PAGE_THUMBNAIL"),
- GURL("chrome://theme/IDR_NEWTAB_CHROME_STORE_PAGE_FAVICON")};
- return page;
-}
-
-// static
-GURL MostVisitedHandler::GetChromeStoreURLWithLocale() {
- return google_util::AppendGoogleLocaleParam(
- GURL(Extension::ChromeStoreURL()));
-}
-
void MostVisitedHandler::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
@@ -631,11 +572,3 @@ void MostVisitedHandler::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterDictionaryPref(prefs::kNTPMostVisitedURLsBlacklist);
prefs->RegisterDictionaryPref(prefs::kNTPMostVisitedPinnedURLs);
}
-
-bool MostVisitedHandler::HasApps() const {
- ExtensionsService* service = dom_ui_->GetProfile()->GetExtensionsService();
- if (!service)
- return false;
-
- return service->HasApps();
-}
diff --git a/chrome/browser/dom_ui/most_visited_handler.h b/chrome/browser/dom_ui/most_visited_handler.h
index 979a9ab..fdfd7cd 100644
--- a/chrome/browser/dom_ui/most_visited_handler.h
+++ b/chrome/browser/dom_ui/most_visited_handler.h
@@ -63,9 +63,6 @@ class MostVisitedHandler : public DOMMessageHandler,
static void RegisterUserPrefs(PrefService* prefs);
- // Returns Chrome Store URL with locale applied.
- static GURL GetChromeStoreURLWithLocale();
-
private:
struct MostVisitedPage;
@@ -112,11 +109,6 @@ class MostVisitedHandler : public DOMMessageHandler,
static const std::vector<MostVisitedPage>& GetPrePopulatedPages();
- static MostVisitedPage GetChromeStorePage();
-
- // Whether we have any apps installed.
- bool HasApps() const;
-
NotificationRegistrar registrar_;
// Our consumer for the history service.
diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc
index ad49b64..c0e4580 100644
--- a/chrome/browser/history/top_sites.cc
+++ b/chrome/browser/history/top_sites.cc
@@ -16,8 +16,6 @@
#include "base/values.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/dom_ui/most_visited_handler.h"
-#include "chrome/browser/extensions/extensions_service.h"
-#include "chrome/browser/google_util.h"
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/page_usage_data.h"
#include "chrome/browser/history/top_sites_database.h"
@@ -271,63 +269,6 @@ static int IndexOf(const MostVisitedURLList& urls, const GURL& url) {
return -1;
}
-int TopSites::GetIndexForChromeStore(const MostVisitedURLList& urls) {
- GURL store_url = MostVisitedHandler::GetChromeStoreURLWithLocale();
- {
- AutoLock lock(lock_);
- if (IsBlacklisted(store_url))
- return -1;
- }
-
- if (IndexOf(urls, store_url) != -1)
- return -1; // It's already there, no need to add.
-
- // Should replace the first filler.
- int first_filler = IndexOf(urls, GURL());
- if (first_filler != -1)
- return first_filler;
-
- if (urls.size() < kTopSitesShown)
- return urls.size();
-
- // Should replace the last non-pinned url.
- for (size_t i = kTopSitesShown - 1; i < urls.size(); i--) {
- if (!IsURLPinned(urls[i].url))
- return i;
- }
-
- // All urls are pinned.
- return -1;
-}
-
-bool TopSites::AddChromeStore(MostVisitedURLList* urls) {
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableApps))
- return false;
-
- if (!profile_)
- return false;
-
- ExtensionsService* service = profile_->GetExtensionsService();
- if (!service || service->HasApps())
- return false;
-
- int index = GetIndexForChromeStore(*urls);
- if (index == -1)
- return false;
-
- if (static_cast<size_t>(index) >= urls->size())
- urls->resize(index + 1);
-
- // Chrome App store may replace an existing non-pinned thumbnail.
- MostVisitedURL& url = (*urls)[index];
- url.url = MostVisitedHandler::GetChromeStoreURLWithLocale();
- url.title = l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE);
- url.favicon_url =
- GURL("chrome://theme/IDR_NEWTAB_CHROME_STORE_PAGE_FAVICON");
- url.redirects.push_back(url.url);
- return true;
-}
-
bool TopSites::AddPrepopulatedPages(MostVisitedURLList* urls) {
// TODO(arv): This needs to get the data from some configurable place.
// http://crbug.com/17630
@@ -356,9 +297,6 @@ bool TopSites::AddPrepopulatedPages(MostVisitedURLList* urls) {
added = true;
}
- if (AddChromeStore(urls))
- added = true;
-
return added;
}
diff --git a/chrome/browser/history/top_sites.h b/chrome/browser/history/top_sites.h
index 8c11681..b4063ab 100644
--- a/chrome/browser/history/top_sites.h
+++ b/chrome/browser/history/top_sites.h
@@ -153,7 +153,6 @@ class TopSites :
FRIEND_TEST_ALL_PREFIXES(TopSitesTest, PinnedURLs);
FRIEND_TEST_ALL_PREFIXES(TopSitesTest, BlacklistingAndPinnedURLs);
FRIEND_TEST_ALL_PREFIXES(TopSitesTest, AddPrepopulatedPages);
- FRIEND_TEST_ALL_PREFIXES(TopSitesTest, GetIndexForChromeStore);
~TopSites();
@@ -270,14 +269,6 @@ class TopSites :
const RefCountedBytes* thumbnail,
const ThumbnailScore& score);
- // Returns an index of a thumbnail that should be replaced by the
- // Chrome App Store. Returns -1 App Store should not be added.
- int GetIndexForChromeStore(const MostVisitedURLList& urls);
-
- // Adds Chrome App Store thumbnail to a list of URLs, if possible.
- // Returns true if it was added.
- bool AddChromeStore(MostVisitedURLList* urls);
-
// Add prepopulated pages: 'welcome to Chrome' and themes gallery.
// Returns true if any pages were added.
bool AddPrepopulatedPages(MostVisitedURLList* urls);
diff --git a/chrome/browser/history/top_sites_unittest.cc b/chrome/browser/history/top_sites_unittest.cc
index d6b7ae0..d0ab05f 100644
--- a/chrome/browser/history/top_sites_unittest.cc
+++ b/chrome/browser/history/top_sites_unittest.cc
@@ -1288,52 +1288,4 @@ TEST_F(TopSitesTest, AddPrepopulatedPages) {
EXPECT_EQ(welcome_url(), pages[1].url);
}
-TEST_F(TopSitesTest, GetIndexForChromeStore) {
- MostVisitedURLList pages;
- EXPECT_EQ(0, top_sites().GetIndexForChromeStore(pages));
-
- MostVisitedURL url = {themes_url()};
- pages.push_back(url);
- EXPECT_EQ(1, top_sites().GetIndexForChromeStore(pages));
-
- // Store should be added in the first filler.
- top_sites().AddPinnedURL(welcome_url(), 3);
- top_sites().AddPinnedURL(GURL("http://google.com"), 5);
- EXPECT_EQ(1, top_sites().GetIndexForChromeStore(pages));
-
- GURL store_url = MostVisitedHandler::GetChromeStoreURLWithLocale();
- url.url = store_url;
- pages.push_back(url);
-
- // Don't add store again.
- EXPECT_EQ(-1, top_sites().GetIndexForChromeStore(pages));
-
- pages.pop_back();
- EXPECT_EQ(1, top_sites().GetIndexForChromeStore(pages));
-
- pages.clear();
- url.url = GURL("http://bbc.com/");
- for (int i = 0; i < 8; i++) {
- pages.push_back(url);
- }
-
- EXPECT_EQ(7, top_sites().GetIndexForChromeStore(pages));
-
- pages[7].url = GURL("http://gmail.com");
- top_sites().AddPinnedURL(GURL("http://gmail.com"), 7);
-
- EXPECT_EQ(6, top_sites().GetIndexForChromeStore(pages));
-
- // If it's blacklisted, it should not be added.
- top_sites().AddBlacklistedURL(store_url);
- EXPECT_EQ(-1, top_sites().GetIndexForChromeStore(pages));
-
- top_sites().RemoveBlacklistedURL(store_url);
- EXPECT_EQ(6, top_sites().GetIndexForChromeStore(pages));
-
- top_sites().AddPinnedURL(GURL("http://bbc.com"), 2);
- // All pinned - can't add store.
- EXPECT_EQ(-1, top_sites().GetIndexForChromeStore(pages));
-}
-
} // namespace history