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

Side by Side Diff: chrome/browser/history/history_tab_helper.h

Issue 7054008: Remove history dependency from content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_TAB_HELPER_H_
6 #define CHROME_BROWSER_HISTORY_HISTORY_TAB_HELPER_H_
7 #pragma once
8
9 #include "content/browser/tab_contents/tab_contents_observer.h"
10 #include "content/common/notification_observer.h"
11 #include "content/common/notification_registrar.h"
12
13 class HistoryService;
14 class SkBitmap;
15 struct ThumbnailScore;
16
17 namespace history {
18 class HistoryAddPageArgs;
19 }
20
21 class HistoryTabHelper : public TabContentsObserver,
22 public NotificationObserver {
23 public:
24 explicit HistoryTabHelper(TabContents* tab_contents);
25 ~HistoryTabHelper();
26
27 // Updates history with the specified navigation. This is called by
28 // OnMsgNavigate to update history state.
29 void UpdateHistoryForNavigation(
30 scoped_refptr<history::HistoryAddPageArgs> add_page_args);
31
32 // Sends the page title to the history service. This is called when we receive
33 // the page title and we know we want to update history.
34 void UpdateHistoryPageTitle(const NavigationEntry& entry);
35
36 // Returns the history::HistoryAddPageArgs to use for adding a page to
37 // history.
38 scoped_refptr<history::HistoryAddPageArgs> CreateHistoryAddPageArgs(
39 const GURL& virtual_url,
40 const NavigationController::LoadCommittedDetails& details,
41 const ViewHostMsg_FrameNavigate_Params& params);
42
43 private:
44 // TabContentsObserver implementation.
45 virtual bool OnMessageReceived(const IPC::Message& message);
46 virtual void DidNavigateMainFramePostCommit(
47 const NavigationController::LoadCommittedDetails& details,
48 const ViewHostMsg_FrameNavigate_Params& params);
49 virtual void DidNavigateAnyFramePostCommit(
50 const NavigationController::LoadCommittedDetails& details,
51 const ViewHostMsg_FrameNavigate_Params& params);
52
53 // NotificationObserver implementation.
54 virtual void Observe(NotificationType type,
55 const NotificationSource& source,
56 const NotificationDetails& details);
57
58 void OnPageContents(const GURL& url,
59 int32 page_id,
60 const string16& contents);
61 void OnThumbnail(const GURL& url,
62 const ThumbnailScore& score,
63 const SkBitmap& bitmap);
64
65 // Helper function to return the history service. May return NULL.
66 HistoryService* GetHistoryService();
67
68 // Whether we have a (non-empty) title for the current page.
69 // Used to prevent subsequent title updates from affecting history. This
70 // prevents some weirdness because some AJAXy apps use titles for status
71 // messages.
72 bool received_page_title_;
73
74 NotificationRegistrar registrar_;
75
76 DISALLOW_COPY_AND_ASSIGN(HistoryTabHelper);
77 };
78
79 #endif // CHROME_BROWSER_HISTORY_HISTORY_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698