| 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" |
| 11 #include "chrome/browser/dom_ui/dom_ui.h" | 12 #include "chrome/browser/dom_ui/dom_ui.h" |
| 12 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 13 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 13 #include "chrome/common/notification_registrar.h" | 14 #include "chrome/common/notification_registrar.h" |
| 14 | 15 |
| 15 class GURL; | 16 class GURL; |
| 16 class MessageLoop; | 17 class MessageLoop; |
| 17 class PrefService; | 18 class PrefService; |
| 18 class Profile; | 19 class Profile; |
| 19 | 20 |
| 20 // The TabContents used for the New Tab page. | 21 // The TabContents used for the New Tab page. |
| 21 class NewTabUI : public DOMUI, | 22 class NewTabUI : public DOMUI, |
| 22 public NotificationObserver { | 23 public NotificationObserver, |
| 24 public BookmarkModelObserver { |
| 23 public: | 25 public: |
| 24 explicit NewTabUI(TabContents* manager); | 26 explicit NewTabUI(TabContents* manager); |
| 25 ~NewTabUI(); | 27 ~NewTabUI(); |
| 26 | 28 |
| 27 // Override DOMUI methods so we can hook up the paint timer to the render | 29 // Override DOMUI methods so we can hook up the paint timer to the render |
| 28 // view host. | 30 // view host. |
| 29 virtual void RenderViewCreated(RenderViewHost* render_view_host); | 31 virtual void RenderViewCreated(RenderViewHost* render_view_host); |
| 30 virtual void RenderViewReused(RenderViewHost* render_view_host); | 32 virtual void RenderViewReused(RenderViewHost* render_view_host); |
| 31 | 33 |
| 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 |
| 32 static void RegisterUserPrefs(PrefService* prefs); | 57 static void RegisterUserPrefs(PrefService* prefs); |
| 33 static void MigrateUserPrefs(PrefService* prefs, int old_pref_version, | 58 static void MigrateUserPrefs(PrefService* prefs, int old_pref_version, |
| 34 int new_pref_version); | 59 int new_pref_version); |
| 35 | 60 |
| 36 // Whether we should disable the web resources backend service | 61 // Whether we should disable the web resources backend service |
| 37 static bool WebResourcesEnabled(); | 62 static bool WebResourcesEnabled(); |
| 38 | 63 |
| 39 // Whether we should disable the first run notification based on the command | 64 // Whether we should disable the first run notification based on the command |
| 40 // line switch. | 65 // line switch. |
| 41 static bool FirstRunDisabled(); | 66 static bool FirstRunDisabled(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 120 |
| 96 NotificationRegistrar registrar_; | 121 NotificationRegistrar registrar_; |
| 97 | 122 |
| 98 // The preference version. This used for migrating prefs of the NTP. | 123 // The preference version. This used for migrating prefs of the NTP. |
| 99 static const int current_pref_version_ = 2; | 124 static const int current_pref_version_ = 2; |
| 100 | 125 |
| 101 DISALLOW_COPY_AND_ASSIGN(NewTabUI); | 126 DISALLOW_COPY_AND_ASSIGN(NewTabUI); |
| 102 }; | 127 }; |
| 103 | 128 |
| 104 #endif // CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ | 129 #endif // CHROME_BROWSER_DOM_UI_NEW_TAB_UI_H_ |
| OLD | NEW |