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

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: Addressed Dan's comments Created 8 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 | 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 14 matching lines...) Expand all
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 to show the link to the CWS in the footer. 38 // Returns whether or not to show the link to the CWS in the footer.
38 static bool ShouldShowWebStoreFooterLink(); 39 static bool ShouldShowWebStoreFooterLink();
39 40
40 // Returns whether or not to show the app install hint. 41 // Returns whether or not to show the app install hint.
41 static bool ShouldShowAppInstallHint(); 42 static bool ShouldShowAppInstallHint();
42 43
44 // Returns whether or not the "suggestions links page" is enabled.
45 static bool IsSuggestionsPageEnabled();
46
43 // Adds "url", "title", and "direction" keys on incoming dictionary, setting 47 // Adds "url", "title", and "direction" keys on incoming dictionary, setting
44 // title as the url as a fallback on empty title. 48 // title as the url as a fallback on empty title.
45 static void SetURLTitleAndDirection(base::DictionaryValue* dictionary, 49 static void SetURLTitleAndDirection(base::DictionaryValue* dictionary,
46 const string16& title, 50 const string16& title,
47 const GURL& gurl); 51 const GURL& gurl);
48 52
49 // Returns a pointer to a NewTabUI if the WebUIController object is a new tab 53 // Returns a pointer to a NewTabUI if the WebUIController object is a new tab
50 // page. 54 // page.
51 static NewTabUI* FromWebUIController(content::WebUIController* ui); 55 static NewTabUI* FromWebUIController(content::WebUIController* ui);
52 56
(...skipping 18 matching lines...) Expand all
71 // Called when the network layer has requested a resource underneath 75 // Called when the network layer has requested a resource underneath
72 // the path we registered. 76 // the path we registered.
73 virtual void StartDataRequest(const std::string& path, 77 virtual void StartDataRequest(const std::string& path,
74 bool is_incognito, 78 bool is_incognito,
75 int request_id) OVERRIDE; 79 int request_id) OVERRIDE;
76 80
77 virtual std::string GetMimeType(const std::string&) const OVERRIDE; 81 virtual std::string GetMimeType(const std::string&) const OVERRIDE;
78 82
79 virtual bool ShouldReplaceExistingSource() const OVERRIDE; 83 virtual bool ShouldReplaceExistingSource() const OVERRIDE;
80 84
85 // Adds |resource| to the source. |resource_id| is resource id or 0,
86 // which means return empty data set. |mime_type| is mime type of the
87 // resource.
88 void AddResource(const char* resource, const char *mime_type,
Dan Beam 2012/02/28 23:01:23 here as well
89 int resource_id);
90
81 private: 91 private:
82 virtual ~NewTabHTMLSource() {} 92 virtual ~NewTabHTMLSource() {}
83 93
84 // Pointer back to the original profile. 94 // Pointer back to the original profile.
85 Profile* profile_; 95 Profile* profile_;
86 96
97 // Maps resource files to mime types an resource ids.
98 std::map<std::string, std::pair<std::string, int> > resource_map_;
99
87 DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource); 100 DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource);
88 }; 101 };
89 102
90 private: 103 private:
91 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion); 104 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion);
92 105
93 virtual void Observe(int type, 106 virtual void Observe(int type,
94 const content::NotificationSource& source, 107 const content::NotificationSource& source,
95 const content::NotificationDetails& details) OVERRIDE; 108 const content::NotificationDetails& details) OVERRIDE;
96 109
(...skipping 18 matching lines...) Expand all
115 128
116 // If the sync promo NTP bubble is being shown. 129 // If the sync promo NTP bubble is being shown.
117 bool showing_sync_bubble_; 130 bool showing_sync_bubble_;
118 131
119 DISALLOW_COPY_AND_ASSIGN(NewTabUI); 132 DISALLOW_COPY_AND_ASSIGN(NewTabUI);
120 }; 133 };
121 134
122 extern const char kWebStoreLinkExperiment[]; 135 extern const char kWebStoreLinkExperiment[];
123 136
124 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ 137 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698