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

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_page_handler.h

Issue 11953021: Don't show the apps page on the NTP if the app launcher is installed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move getShouldShowApps message to onLoad. Created 7 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_
7 7
8 #include "base/memory/weak_ptr.h"
8 #include "base/values.h" 9 #include "base/values.h"
9 #include "chrome/common/chrome_notification_types.h" 10 #include "chrome/common/chrome_notification_types.h"
10 #include "content/public/browser/web_ui_message_handler.h" 11 #include "content/public/browser/web_ui_message_handler.h"
11 12
12 class PrefServiceSimple; 13 class PrefServiceSimple;
13 class PrefServiceSyncable; 14 class PrefServiceSyncable;
14 class Profile; 15 class Profile;
15 16
16 // Handler for general New Tab Page functionality that does not belong in a 17 // Handler for general New Tab Page functionality that does not belong in a
17 // more specialized handler. 18 // more specialized handler.
18 class NewTabPageHandler : public content::WebUIMessageHandler { 19 class NewTabPageHandler : public content::WebUIMessageHandler,
20 public base::SupportsWeakPtr<NewTabPageHandler> {
19 public: 21 public:
20 NewTabPageHandler(); 22 NewTabPageHandler();
21 23
22 // Register NTP per-profile preferences. 24 // Register NTP per-profile preferences.
23 static void RegisterUserPrefs(PrefServiceSyncable* prefs); 25 static void RegisterUserPrefs(PrefServiceSyncable* prefs);
24 26
25 // Registers values (strings etc.) for the page. 27 // Registers values (strings etc.) for the page.
26 static void GetLocalizedValues(Profile* profile, DictionaryValue* values); 28 static void GetLocalizedValues(Profile* profile, DictionaryValue* values);
27 29
28 private: 30 private:
(...skipping 19 matching lines...) Expand all
48 50
49 // Callback for "bubblePromoLinkClicked". No arguments. 51 // Callback for "bubblePromoLinkClicked". No arguments.
50 void HandleBubblePromoLinkClicked(const ListValue* args); 52 void HandleBubblePromoLinkClicked(const ListValue* args);
51 53
52 // Callback for "pageSelected". 54 // Callback for "pageSelected".
53 void HandlePageSelected(const ListValue* args); 55 void HandlePageSelected(const ListValue* args);
54 56
55 // Callback for "logTimeToClick". 57 // Callback for "logTimeToClick".
56 void HandleLogTimeToClick(const base::ListValue* args); 58 void HandleLogTimeToClick(const base::ListValue* args);
57 59
60 // Callback for the "getShouldShowApps" message.
61 void HandleGetShouldShowApps(const base::ListValue* args);
62
63 // Callback from extensions::UpdateIsAppLauncherEnabled().
64 void GotIsAppLauncherEnabled(bool is_enabled);
65
58 // Tracks the number of times the user has switches pages (for UMA). 66 // Tracks the number of times the user has switches pages (for UMA).
59 size_t page_switch_count_; 67 size_t page_switch_count_;
60 68
61 // The purpose of this enum is to track which page on the NTP is showing. 69 // The purpose of this enum is to track which page on the NTP is showing.
62 // The lower 10 bits of kNtpShownPage are used for the index within the page 70 // The lower 10 bits of kNtpShownPage are used for the index within the page
63 // group, and the rest of the bits are used for the page group ID (defined 71 // group, and the rest of the bits are used for the page group ID (defined
64 // here). 72 // here).
65 static const int kPageIdOffset = 10; 73 static const int kPageIdOffset = 10;
66 // TODO(vadimt): create a new enum and a new UMA histogram for search ntp so 74 // TODO(vadimt): create a new enum and a new UMA histogram for search ntp so
67 // the two histograms don't get mixed in together. 75 // the two histograms don't get mixed in together.
(...skipping 10 matching lines...) Expand all
78 static const int kHistogramEnumerationMax = 86 static const int kHistogramEnumerationMax =
79 (LAST_PAGE_ID >> kPageIdOffset) + 1; 87 (LAST_PAGE_ID >> kPageIdOffset) + 1;
80 88
81 // Helper to send out promo resource change notification. 89 // Helper to send out promo resource change notification.
82 void Notify(chrome::NotificationType notification_type); 90 void Notify(chrome::NotificationType notification_type);
83 91
84 DISALLOW_COPY_AND_ASSIGN(NewTabPageHandler); 92 DISALLOW_COPY_AND_ASSIGN(NewTabPageHandler);
85 }; 93 };
86 94
87 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_ 95 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.js ('k') | chrome/browser/ui/webui/ntp/new_tab_page_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698