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

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

Issue 9358031: Added new adaptive "Suggest" tab on the New Tab Page, behing the flag, for the experiments. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added dynamic loading of the JS and CSS Created 8 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_UI_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ 6 #define CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map>
9 #include <string> 10 #include <string>
10 11
11 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
12 #include "base/time.h" 13 #include "base/time.h"
13 #include "base/timer.h" 14 #include "base/timer.h"
14 #include "chrome/browser/sessions/tab_restore_service.h" 15 #include "chrome/browser/sessions/tab_restore_service.h"
15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
16 #include "content/public/browser/notification_observer.h" 17 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h" 18 #include "content/public/browser/notification_registrar.h"
18 #include "content/public/browser/web_ui_controller.h" 19 #include "content/public/browser/web_ui_controller.h"
(...skipping 11 matching lines...) Expand all
30 31
31 static void RegisterUserPrefs(PrefService* prefs); 32 static void RegisterUserPrefs(PrefService* prefs);
32 33
33 // Sets up any experiment in which the NTP might want to participate. 34 // Sets up any experiment in which the NTP might want to participate.
34 // The CWS footer link is one such example. 35 // The CWS footer link is one such example.
35 static void SetupFieldTrials(); 36 static void SetupFieldTrials();
36 37
37 // Returns whether or not the CWS footer experiment is enabled. 38 // Returns whether or not the CWS footer experiment is enabled.
38 static bool IsWebStoreExperimentEnabled(); 39 static bool IsWebStoreExperimentEnabled();
39 40
41 // Returns whether or not the "suggestions links page" is enabled.
42 static bool IsSuggestionsPageEnabled();
43
40 // Adds "url", "title", and "direction" keys on incoming dictionary, setting 44 // Adds "url", "title", and "direction" keys on incoming dictionary, setting
41 // title as the url as a fallback on empty title. 45 // title as the url as a fallback on empty title.
42 static void SetURLTitleAndDirection(base::DictionaryValue* dictionary, 46 static void SetURLTitleAndDirection(base::DictionaryValue* dictionary,
43 const string16& title, 47 const string16& title,
44 const GURL& gurl); 48 const GURL& gurl);
45 49
46 // Returns a pointer to a NewTabUI if the WebUIController object is a new tab 50 // Returns a pointer to a NewTabUI if the WebUIController object is a new tab
47 // page. 51 // page.
48 static NewTabUI* FromWebUIController(content::WebUIController* ui); 52 static NewTabUI* FromWebUIController(content::WebUIController* ui);
49 53
(...skipping 18 matching lines...) Expand all
68 // Called when the network layer has requested a resource underneath 72 // Called when the network layer has requested a resource underneath
69 // the path we registered. 73 // the path we registered.
70 virtual void StartDataRequest(const std::string& path, 74 virtual void StartDataRequest(const std::string& path,
71 bool is_incognito, 75 bool is_incognito,
72 int request_id) OVERRIDE; 76 int request_id) OVERRIDE;
73 77
74 virtual std::string GetMimeType(const std::string&) const OVERRIDE; 78 virtual std::string GetMimeType(const std::string&) const OVERRIDE;
75 79
76 virtual bool ShouldReplaceExistingSource() const OVERRIDE; 80 virtual bool ShouldReplaceExistingSource() const OVERRIDE;
77 81
82 // Adds |resource| to the source. |resource_id| is resource id or 0,
83 // which means return empty data set. |mime_type| is mime type of the
84 // resource.
85 void AddResource(const char* resource, const char *mime_type,
86 int resource_id);
87
78 private: 88 private:
79 virtual ~NewTabHTMLSource() {} 89 virtual ~NewTabHTMLSource() {}
80 90
81 // Pointer back to the original profile. 91 // Pointer back to the original profile.
82 Profile* profile_; 92 Profile* profile_;
93 // Maps resource files to mime types an resource ids.
94 std::map<std::string, std::pair<std::string, int> > resource_map_;
83 95
84 DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource); 96 DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource);
85 }; 97 };
86 98
87 private: 99 private:
88 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion); 100 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion);
89 101
90 virtual void Observe(int type, 102 virtual void Observe(int type,
91 const content::NotificationSource& source, 103 const content::NotificationSource& source,
92 const content::NotificationDetails& details) OVERRIDE; 104 const content::NotificationDetails& details) OVERRIDE;
(...skipping 17 matching lines...) Expand all
110 // The preference version. This used for migrating prefs of the NTP. 122 // The preference version. This used for migrating prefs of the NTP.
111 static const int current_pref_version_ = 3; 123 static const int current_pref_version_ = 3;
112 124
113 // If the sync promo NTP bubble is being shown. 125 // If the sync promo NTP bubble is being shown.
114 bool showing_sync_bubble_; 126 bool showing_sync_bubble_;
115 127
116 DISALLOW_COPY_AND_ASSIGN(NewTabUI); 128 DISALLOW_COPY_AND_ASSIGN(NewTabUI);
117 }; 129 };
118 130
119 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ 131 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698