Home | History | Annotate | Download | only in history
      1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/history/top_sites.h"
      6 
      7 #include "base/strings/string_util.h"
      8 #include "chrome/browser/history/top_sites_impl.h"
      9 #include "chrome/grit/chromium_strings.h"
     10 #include "chrome/grit/generated_resources.h"
     11 #include "chrome/grit/locale_settings.h"
     12 #include "grit/theme_resources.h"
     13 
     14 namespace history {
     15 
     16 const TopSites::PrepopulatedPage kPrepopulatedPages[] = {
     17 #if defined(OS_ANDROID)
     18     { IDS_MOBILE_WELCOME_URL, IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE,
     19     IDR_PRODUCT_LOGO_16, IDR_NEWTAB_CHROME_WELCOME_PAGE_THUMBNAIL,
     20     SkColorSetRGB(0, 147, 60) }
     21 #else
     22   { IDS_CHROME_WELCOME_URL, IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE,
     23     IDR_PRODUCT_LOGO_16, IDR_NEWTAB_CHROME_WELCOME_PAGE_THUMBNAIL,
     24     SkColorSetRGB(0, 147, 60) },
     25 #endif
     26 #if !defined(OS_ANDROID)
     27   { IDS_WEBSTORE_URL, IDS_EXTENSION_WEB_STORE_TITLE,
     28     IDR_WEBSTORE_ICON_16, IDR_NEWTAB_WEBSTORE_THUMBNAIL,
     29     SkColorSetRGB(63, 132, 197) }
     30 #endif
     31 };
     32 
     33 // static
     34 TopSites* TopSites::Create(Profile* profile, const base::FilePath& db_name) {
     35   TopSitesImpl* top_sites_impl = new TopSitesImpl(profile);
     36   top_sites_impl->Init(db_name);
     37   return top_sites_impl;
     38 }
     39 
     40 TopSites::TopSites() {
     41 }
     42 
     43 TopSites::~TopSites() {
     44 }
     45 
     46 void TopSites::AddObserver(TopSitesObserver* observer) {
     47   observer_list_.AddObserver(observer);
     48 }
     49 
     50 void TopSites::RemoveObserver(TopSitesObserver* observer) {
     51   observer_list_.RemoveObserver(observer);
     52 }
     53 
     54 void TopSites::NotifyTopSitesLoaded() {
     55   FOR_EACH_OBSERVER(TopSitesObserver, observer_list_, TopSitesLoaded(this));
     56 }
     57 
     58 void TopSites::NotifyTopSitesChanged() {
     59   FOR_EACH_OBSERVER(TopSitesObserver, observer_list_, TopSitesChanged(this));
     60 }
     61 
     62 }  // namespace history
     63