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

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

Issue 9358073: First version of the time slicing on the urls. Not ready for review yet. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added relative time to time slicing 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/prefs/pref_change_registrar.h" 15 #include "chrome/browser/prefs/pref_change_registrar.h"
15 #include "chrome/browser/sessions/tab_restore_service.h" 16 #include "chrome/browser/sessions/tab_restore_service.h"
16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 17 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
17 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
18 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
(...skipping 15 matching lines...) Expand all
34 // Sets up any experiment in which the NTP might want to participate. 35 // Sets up any experiment in which the NTP might want to participate.
35 // The CWS footer link is one such example. 36 // The CWS footer link is one such example.
36 static void SetupFieldTrials(); 37 static void SetupFieldTrials();
37 38
38 // Returns whether or not to show the link to the CWS in the footer. 39 // Returns whether or not to show the link to the CWS in the footer.
39 static bool ShouldShowWebStoreFooterLink(); 40 static bool ShouldShowWebStoreFooterLink();
40 41
41 // Returns whether or not to show the app install hint. 42 // Returns whether or not to show the app install hint.
42 static bool ShouldShowAppInstallHint(); 43 static bool ShouldShowAppInstallHint();
43 44
45 // Returns whether or not the "suggestions links page" is enabled.
46 static bool IsSuggestionsPageEnabled();
47
44 // Adds "url", "title", and "direction" keys on incoming dictionary, setting 48 // Adds "url", "title", and "direction" keys on incoming dictionary, setting
45 // title as the url as a fallback on empty title. 49 // title as the url as a fallback on empty title.
46 static void SetURLTitleAndDirection(base::DictionaryValue* dictionary, 50 static void SetURLTitleAndDirection(base::DictionaryValue* dictionary,
47 const string16& title, 51 const string16& title,
48 const GURL& gurl); 52 const GURL& gurl);
49 53
50 // Returns a pointer to a NewTabUI if the WebUIController object is a new tab 54 // Returns a pointer to a NewTabUI if the WebUIController object is a new tab
51 // page. 55 // page.
52 static NewTabUI* FromWebUIController(content::WebUIController* ui); 56 static NewTabUI* FromWebUIController(content::WebUIController* ui);
53 57
(...skipping 18 matching lines...) Expand all
72 // Called when the network layer has requested a resource underneath 76 // Called when the network layer has requested a resource underneath
73 // the path we registered. 77 // the path we registered.
74 virtual void StartDataRequest(const std::string& path, 78 virtual void StartDataRequest(const std::string& path,
75 bool is_incognito, 79 bool is_incognito,
76 int request_id) OVERRIDE; 80 int request_id) OVERRIDE;
77 81
78 virtual std::string GetMimeType(const std::string&) const OVERRIDE; 82 virtual std::string GetMimeType(const std::string&) const OVERRIDE;
79 83
80 virtual bool ShouldReplaceExistingSource() const OVERRIDE; 84 virtual bool ShouldReplaceExistingSource() const OVERRIDE;
81 85
86 // Adds |resource| to the source. |resource_id| is resource id or 0,
87 // which means return empty data set. |mime_type| is mime type of the
88 // resource.
89 void AddResource(const char* resource,
90 const char *mime_type,
91 int resource_id);
92
82 private: 93 private:
83 virtual ~NewTabHTMLSource() {} 94 virtual ~NewTabHTMLSource() {}
84 95
85 // Pointer back to the original profile. 96 // Pointer back to the original profile.
86 Profile* profile_; 97 Profile* profile_;
98 // Maps resource files to mime types an resource ids.
99 std::map<std::string, std::pair<std::string, int> > resource_map_;
87 100
88 DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource); 101 DISALLOW_COPY_AND_ASSIGN(NewTabHTMLSource);
89 }; 102 };
90 103
91 private: 104 private:
92 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion); 105 FRIEND_TEST_ALL_PREFIXES(NewTabUITest, UpdateUserPrefsVersion);
93 106
94 virtual void Observe(int type, 107 virtual void Observe(int type,
95 const content::NotificationSource& source, 108 const content::NotificationSource& source,
96 const content::NotificationDetails& details) OVERRIDE; 109 const content::NotificationDetails& details) OVERRIDE;
(...skipping 21 matching lines...) Expand all
118 bool showing_sync_bubble_; 131 bool showing_sync_bubble_;
119 132
120 PrefChangeRegistrar pref_change_registrar_; 133 PrefChangeRegistrar pref_change_registrar_;
121 134
122 DISALLOW_COPY_AND_ASSIGN(NewTabUI); 135 DISALLOW_COPY_AND_ASSIGN(NewTabUI);
123 }; 136 };
124 137
125 extern const char kWebStoreLinkExperiment[]; 138 extern const char kWebStoreLinkExperiment[];
126 139
127 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_ 140 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NEW_TAB_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_page_handler.cc ('k') | chrome/browser/ui/webui/ntp/new_tab_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698