| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DOM_UI_NEW_TAB_UI_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ |
| 6 #define CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ | 6 #define CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "chrome/browser/dom_ui/dom_ui.h" | 12 #include "chrome/browser/dom_ui/dom_ui.h" |
| 13 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 13 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 14 #include "chrome/browser/sessions/tab_restore_service.h" |
| 14 #include "chrome/common/notification_observer.h" | 15 #include "chrome/common/notification_observer.h" |
| 15 #include "chrome/common/notification_registrar.h" | 16 #include "chrome/common/notification_registrar.h" |
| 16 | 17 |
| 17 class GURL; | 18 class GURL; |
| 18 class MessageLoop; | 19 class MessageLoop; |
| 19 class PrefService; | 20 class PrefService; |
| 20 class Profile; | 21 class Profile; |
| 21 | 22 |
| 22 // The TabContents used for the New Tab page. | 23 // The TabContents used for the New Tab page. |
| 23 class NewTabUI : public DOMUI, | 24 class NewTabUI : public DOMUI, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 41 // Whether we should disable the first run notification based on the command | 42 // Whether we should disable the first run notification based on the command |
| 42 // line switch. | 43 // line switch. |
| 43 static bool FirstRunDisabled(); | 44 static bool FirstRunDisabled(); |
| 44 | 45 |
| 45 // Adds "url", "title", and "direction" keys on incoming dictionary, setting | 46 // Adds "url", "title", and "direction" keys on incoming dictionary, setting |
| 46 // title as the url as a fallback on empty title. | 47 // title as the url as a fallback on empty title. |
| 47 static void SetURLTitleAndDirection(DictionaryValue* dictionary, | 48 static void SetURLTitleAndDirection(DictionaryValue* dictionary, |
| 48 const string16& title, | 49 const string16& title, |
| 49 const GURL& gurl); | 50 const GURL& gurl); |
| 50 | 51 |
| 52 // Converts a list of TabRestoreService entries to the JSON format required |
| 53 // by the NTP and adds them to the given list value. |
| 54 static void AddRecentlyClosedEntries( |
| 55 const TabRestoreService::Entries& entries, |
| 56 ListValue* entry_list_value); |
| 57 |
| 51 // The current preference version. | 58 // The current preference version. |
| 52 static int current_pref_version() { return current_pref_version_; } | 59 static int current_pref_version() { return current_pref_version_; } |
| 53 | 60 |
| 54 class NewTabHTMLSource : public ChromeURLDataManager::DataSource { | 61 class NewTabHTMLSource : public ChromeURLDataManager::DataSource { |
| 55 public: | 62 public: |
| 56 explicit NewTabHTMLSource(Profile* profile); | 63 explicit NewTabHTMLSource(Profile* profile); |
| 57 | 64 |
| 58 // Called when the network layer has requested a resource underneath | 65 // Called when the network layer has requested a resource underneath |
| 59 // the path we registered. | 66 // the path we registered. |
| 60 virtual void StartDataRequest(const std::string& path, | 67 virtual void StartDataRequest(const std::string& path, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 102 |
| 96 NotificationRegistrar registrar_; | 103 NotificationRegistrar registrar_; |
| 97 | 104 |
| 98 // The preference version. This used for migrating prefs of the NTP. | 105 // The preference version. This used for migrating prefs of the NTP. |
| 99 static const int current_pref_version_ = 3; | 106 static const int current_pref_version_ = 3; |
| 100 | 107 |
| 101 DISALLOW_COPY_AND_ASSIGN(NewTabUI); | 108 DISALLOW_COPY_AND_ASSIGN(NewTabUI); |
| 102 }; | 109 }; |
| 103 | 110 |
| 104 #endif // CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ | 111 #endif // CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ |
| OLD | NEW |