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

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

Issue 1757673002: NTP4/apps page: fix page stickiness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-promo-cpp
Patch Set: todookie Created 4 years, 9 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_
7
8 #include <stddef.h>
9
10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/values.h"
13 #include "content/public/browser/web_ui_message_handler.h"
14
15 class PrefRegistrySimple;
16 class Profile;
17
18 namespace user_prefs {
19 class PrefRegistrySyncable;
20 }
21
22 // Handler for general New Tab Page functionality that does not belong in a
23 // more specialized handler.
24 class NewTabPageHandler : public content::WebUIMessageHandler,
25 public base::SupportsWeakPtr<NewTabPageHandler> {
26 public:
27 NewTabPageHandler();
28
29 // Register NTP per-profile preferences.
30 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
31
32 // Registers values (strings etc.) for the page.
33 static void GetLocalizedValues(Profile* profile,
34 base::DictionaryValue* values);
35
36 private:
37 ~NewTabPageHandler() override;
38
39 // WebUIMessageHandler implementation.
40 void RegisterMessages() override;
41
42 // Callback for "pageSelected".
43 void HandlePageSelected(const base::ListValue* args);
44
45 // Tracks the number of times the user has switches pages (for UMA).
46 size_t page_switch_count_;
47
48 // The purpose of this enum is to track which page on the NTP is showing.
49 // The lower 10 bits of kNtpShownPage are used for the index within the page
50 // group, and the rest of the bits are used for the page group ID (defined
51 // here).
52 static const int kPageIdOffset = 10;
53 enum {
54 INDEX_MASK = (1 << kPageIdOffset) - 1,
55 APPS_PAGE_ID = 2 << kPageIdOffset,
56 LAST_PAGE_ID = APPS_PAGE_ID,
57 };
58 static const int kHistogramEnumerationMax =
59 (LAST_PAGE_ID >> kPageIdOffset) + 1;
60
61 DISALLOW_COPY_AND_ASSIGN(NewTabPageHandler);
62 };
63
64 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_PAGE_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/app_launcher_handler.cc ('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