| OLD | NEW |
| 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_BOOKMARKS_BOOKMARK_PROMPT_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_PROMPT_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_PROMPT_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_PROMPT_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/common/cancelable_request.h" | 10 #include "chrome/browser/common/cancelable_request.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 static void AddedBookmark(Browser* browser, const GURL& url); | 52 static void AddedBookmark(Browser* browser, const GURL& url); |
| 53 | 53 |
| 54 // Invoked when bookmark prompt is closing. | 54 // Invoked when bookmark prompt is closing. |
| 55 static void ClosingBookmarkPrompt(); | 55 static void ClosingBookmarkPrompt(); |
| 56 | 56 |
| 57 // Disable bookmark prompt feature in a profile in |prefs|. | 57 // Disable bookmark prompt feature in a profile in |prefs|. |
| 58 static void DisableBookmarkPrompt(PrefServiceBase* prefs); | 58 static void DisableBookmarkPrompt(PrefServiceBase* prefs); |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 // TabStripModelObserver | 61 // TabStripModelObserver |
| 62 virtual void ActiveTabChanged(TabContents* old_contents, | 62 virtual void ActiveTabChanged(content::WebContents* old_contents, |
| 63 TabContents* new_contents, | 63 content::WebContents* new_contents, |
| 64 int index, | 64 int index, |
| 65 bool user_gesture) OVERRIDE; | 65 bool user_gesture) OVERRIDE; |
| 66 | 66 |
| 67 void AddedBookmarkInternal(Browser* browser, const GURL& url); | 67 void AddedBookmarkInternal(Browser* browser, const GURL& url); |
| 68 void ClosingBookmarkPromptInternal(); | 68 void ClosingBookmarkPromptInternal(); |
| 69 | 69 |
| 70 // content::NotificationObserver: | 70 // content::NotificationObserver: |
| 71 virtual void Observe(int type, | 71 virtual void Observe(int type, |
| 72 const content::NotificationSource& source, | 72 const content::NotificationSource& source, |
| 73 const content::NotificationDetails& details) OVERRIDE; | 73 const content::NotificationDetails& details) OVERRIDE; |
| 74 | 74 |
| 75 // chrome::BrowserListObserver | 75 // chrome::BrowserListObserver |
| 76 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; | 76 virtual void OnBrowserRemoved(Browser* browser) OVERRIDE; |
| 77 virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE; | 77 virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE; |
| 78 | 78 |
| 79 // Callback for the HistoryService::QueryURL | 79 // Callback for the HistoryService::QueryURL |
| 80 void OnDidQueryURL(CancelableRequestProvider::Handle handle, | 80 void OnDidQueryURL(CancelableRequestProvider::Handle handle, |
| 81 bool success, | 81 bool success, |
| 82 const history::URLRow* url_row, | 82 const history::URLRow* url_row, |
| 83 history::VisitVector* visits); | 83 history::VisitVector* visits); |
| 84 | 84 |
| 85 // Set current active browser cache to |browser|. |browser| can be null. | 85 // Set current active browser cache to |browser|. |browser| can be null. |
| 86 void SetBrowser(Browser* browser); | 86 void SetBrowser(Browser* browser); |
| 87 | 87 |
| 88 // Set current active WebContents cache from |tab_contents|. |tab_contents| | 88 // Set current active WebContents cache from |web_contents|. |web_contents| |
| 89 // can be null. | 89 // can be null. |
| 90 void SetWebContents(TabContents* tab_contents); | 90 void SetWebContents(content::WebContents* web_contents); |
| 91 | 91 |
| 92 // Current active browser cache which we will display the prompt on it. | 92 // Current active browser cache which we will display the prompt on it. |
| 93 Browser* browser_; | 93 Browser* browser_; |
| 94 | 94 |
| 95 // Current active WebContents cache which we will display the prompt for it. | 95 // Current active WebContents cache which we will display the prompt for it. |
| 96 content::WebContents* web_contents_; | 96 content::WebContents* web_contents_; |
| 97 | 97 |
| 98 // Remember last URL for recording metrics. | 98 // Remember last URL for recording metrics. |
| 99 GURL last_prompted_url_; | 99 GURL last_prompted_url_; |
| 100 | 100 |
| 101 // Last prompted time is used for measuring duration of prompt displaying | 101 // Last prompted time is used for measuring duration of prompt displaying |
| 102 // time. | 102 // time. |
| 103 base::Time last_prompted_time_; | 103 base::Time last_prompted_time_; |
| 104 | 104 |
| 105 // Start time of HistoryService::QueryURL. | 105 // Start time of HistoryService::QueryURL. |
| 106 base::Time query_url_start_time_; | 106 base::Time query_url_start_time_; |
| 107 | 107 |
| 108 CancelableRequestConsumer query_url_consumer_; | 108 CancelableRequestConsumer query_url_consumer_; |
| 109 content::NotificationRegistrar registrar_; | 109 content::NotificationRegistrar registrar_; |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(BookmarkPromptController); | 111 DISALLOW_COPY_AND_ASSIGN(BookmarkPromptController); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_PROMPT_CONTROLLER_H_ | 114 #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_PROMPT_CONTROLLER_H_ |
| OLD | NEW |