| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 11 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | |
| 12 #include "chrome/browser/dom_ui/dom_ui.h" | 11 #include "chrome/browser/dom_ui/dom_ui.h" |
| 13 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 12 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 14 #include "chrome/common/notification_registrar.h" | 13 #include "chrome/common/notification_registrar.h" |
| 15 | 14 |
| 16 class GURL; | 15 class GURL; |
| 17 class MessageLoop; | 16 class MessageLoop; |
| 18 class PrefService; | 17 class PrefService; |
| 19 class Profile; | 18 class Profile; |
| 20 | 19 |
| 21 // The TabContents used for the New Tab page. | 20 // The TabContents used for the New Tab page. |
| 22 class NewTabUI : public DOMUI, | 21 class NewTabUI : public DOMUI, |
| 23 public NotificationObserver, | 22 public NotificationObserver { |
| 24 public BookmarkModelObserver { | |
| 25 public: | 23 public: |
| 26 explicit NewTabUI(TabContents* manager); | 24 explicit NewTabUI(TabContents* manager); |
| 27 ~NewTabUI(); | 25 ~NewTabUI(); |
| 28 | 26 |
| 29 // Override DOMUI methods so we can hook up the paint timer to the render | 27 // Override DOMUI methods so we can hook up the paint timer to the render |
| 30 // view host. | 28 // view host. |
| 31 virtual void RenderViewCreated(RenderViewHost* render_view_host); | 29 virtual void RenderViewCreated(RenderViewHost* render_view_host); |
| 32 virtual void RenderViewReused(RenderViewHost* render_view_host); | 30 virtual void RenderViewReused(RenderViewHost* render_view_host); |
| 33 | 31 |
| 34 // Overridden from BookmarkModelObserver so we can remove the promo for | |
| 35 // importing bookmarks if the user adds a bookmark in any way. | |
| 36 virtual void BookmarkNodeAdded(BookmarkModel* model, | |
| 37 const BookmarkNode* parent, | |
| 38 int index); | |
| 39 | |
| 40 // These methods must be overridden so that the NTP can be a | |
| 41 // BookmarkModelObserver. | |
| 42 virtual void Loaded(BookmarkModel* model) {} | |
| 43 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) {} | |
| 44 virtual void BookmarkNodeMoved(BookmarkModel* model, | |
| 45 const BookmarkNode* old_parent, int old_index, | |
| 46 const BookmarkNode* new_parent, int new_index) {} | |
| 47 virtual void BookmarkNodeRemoved(BookmarkModel* model, | |
| 48 const BookmarkNode* parent, int old_index, | |
| 49 const BookmarkNode* node) {} | |
| 50 virtual void BookmarkNodeChanged(BookmarkModel* model, | |
| 51 const BookmarkNode* node) {} | |
| 52 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, | |
| 53 const BookmarkNode* node) {} | |
| 54 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, | |
| 55 const BookmarkNode* node) {} | |
| 56 | |
| 57 static void RegisterUserPrefs(PrefService* prefs); | 32 static void RegisterUserPrefs(PrefService* prefs); |
| 58 static void MigrateUserPrefs(PrefService* prefs, int old_pref_version, | 33 static void MigrateUserPrefs(PrefService* prefs, int old_pref_version, |
| 59 int new_pref_version); | 34 int new_pref_version); |
| 60 | 35 |
| 61 // Whether we should disable the web resources backend service | 36 // Whether we should disable the web resources backend service |
| 62 static bool WebResourcesEnabled(); | 37 static bool WebResourcesEnabled(); |
| 63 | 38 |
| 64 // Whether we should disable the first run notification based on the command | 39 // Whether we should disable the first run notification based on the command |
| 65 // line switch. | 40 // line switch. |
| 66 static bool FirstRunDisabled(); | 41 static bool FirstRunDisabled(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 95 |
| 121 NotificationRegistrar registrar_; | 96 NotificationRegistrar registrar_; |
| 122 | 97 |
| 123 // The preference version. This used for migrating prefs of the NTP. | 98 // The preference version. This used for migrating prefs of the NTP. |
| 124 static const int current_pref_version_ = 2; | 99 static const int current_pref_version_ = 2; |
| 125 | 100 |
| 126 DISALLOW_COPY_AND_ASSIGN(NewTabUI); | 101 DISALLOW_COPY_AND_ASSIGN(NewTabUI); |
| 127 }; | 102 }; |
| 128 | 103 |
| 129 #endif // CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ | 104 #endif // CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ |
| OLD | NEW |