Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: chrome/browser/dom_ui/new_tab_ui.cc

Issue 160027: Make the NNTP listen for the correct theme changed notification.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/dom_ui/new_tab_ui.h" 7 #include "chrome/browser/dom_ui/new_tab_ui.h"
8 8
9 #include "app/animation.h" 9 #include "app/animation.h"
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 1462
1463 NewTabHTMLSource* html_source = new NewTabHTMLSource(GetProfile()); 1463 NewTabHTMLSource* html_source = new NewTabHTMLSource(GetProfile());
1464 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, 1464 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
1465 NewRunnableMethod(&chrome_url_data_manager, 1465 NewRunnableMethod(&chrome_url_data_manager,
1466 &ChromeURLDataManager::AddDataSource, 1466 &ChromeURLDataManager::AddDataSource,
1467 html_source)); 1467 html_source));
1468 } 1468 }
1469 } 1469 }
1470 1470
1471 // Listen for theme installation. 1471 // Listen for theme installation.
1472 registrar_.Add(this, NotificationType::THEME_INSTALLED, 1472 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
1473 NotificationService::AllSources()); 1473 NotificationService::AllSources());
1474 // Listen for bookmark bar visibility changes. 1474 // Listen for bookmark bar visibility changes.
1475 registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, 1475 registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
1476 NotificationService::AllSources()); 1476 NotificationService::AllSources());
1477 } 1477 }
1478 1478
1479 NewTabUI::~NewTabUI() { 1479 NewTabUI::~NewTabUI() {
1480 } 1480 }
1481 1481
1482 void NewTabUI::Observe(NotificationType type, 1482 void NewTabUI::Observe(NotificationType type,
1483 const NotificationSource& source, 1483 const NotificationSource& source,
1484 const NotificationDetails& details) { 1484 const NotificationDetails& details) {
1485 if (NotificationType::THEME_INSTALLED == type) { 1485 if (NotificationType::BROWSER_THEME_CHANGED == type) {
1486 CallJavascriptFunction(L"themeChanged"); 1486 CallJavascriptFunction(L"themeChanged");
1487 } else if (NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED) { 1487 } else if (NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED) {
1488 if (GetProfile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar)) 1488 if (GetProfile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar))
1489 CallJavascriptFunction(L"bookmarkBarAttached"); 1489 CallJavascriptFunction(L"bookmarkBarAttached");
1490 else 1490 else
1491 CallJavascriptFunction(L"bookmarkBarDetached"); 1491 CallJavascriptFunction(L"bookmarkBarDetached");
1492 } 1492 }
1493 } 1493 }
1494 1494
1495 // static 1495 // static
1496 void NewTabUI::RegisterUserPrefs(PrefService* prefs) { 1496 void NewTabUI::RegisterUserPrefs(PrefService* prefs) {
1497 MostVisitedHandler::RegisterUserPrefs(prefs); 1497 MostVisitedHandler::RegisterUserPrefs(prefs);
1498 ShownSectionsHandler::RegisterUserPrefs(prefs); 1498 ShownSectionsHandler::RegisterUserPrefs(prefs);
1499 if (!NewTabUI::WebResourcesDisabled()) 1499 if (!NewTabUI::WebResourcesDisabled())
1500 TipsHandler::RegisterUserPrefs(prefs); 1500 TipsHandler::RegisterUserPrefs(prefs);
1501 } 1501 }
1502 1502
1503 // static 1503 // static
1504 bool NewTabUI::UseOldNewTabPage() { 1504 bool NewTabUI::UseOldNewTabPage() {
1505 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 1505 const CommandLine* command_line = CommandLine::ForCurrentProcess();
1506 return command_line->HasSwitch(switches::kOldNewTabPage); 1506 return command_line->HasSwitch(switches::kOldNewTabPage);
1507 } 1507 }
1508 1508
1509 // static 1509 // static
1510 bool NewTabUI::WebResourcesDisabled() { 1510 bool NewTabUI::WebResourcesDisabled() {
1511 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 1511 const CommandLine* command_line = CommandLine::ForCurrentProcess();
1512 return command_line->HasSwitch(switches::kDisableWebResources); 1512 return command_line->HasSwitch(switches::kDisableWebResources);
1513 } 1513 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698