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

Side by Side Diff: chrome/browser/android/offline_pages/recent_tab_helper.h

Issue 2705323006: Last_n: Do not save a snapshot of a closing tab. (Closed)
Patch Set: Minor comment changes. Created 3 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 22 matching lines...) Expand all
33 public: 33 public:
34 ~RecentTabHelper() override; 34 ~RecentTabHelper() override;
35 35
36 // content::WebContentsObserver 36 // content::WebContentsObserver
37 void DidFinishNavigation( 37 void DidFinishNavigation(
38 content::NavigationHandle* navigation_handle) override; 38 content::NavigationHandle* navigation_handle) override;
39 void DocumentAvailableInMainFrame() override; 39 void DocumentAvailableInMainFrame() override;
40 void DocumentOnLoadCompletedInMainFrame() override; 40 void DocumentOnLoadCompletedInMainFrame() override;
41 void WebContentsDestroyed() override; 41 void WebContentsDestroyed() override;
42 void WasHidden() override; 42 void WasHidden() override;
43 void WasShown() override;
44
45 // Notifies that the tab of the associated WebContents will (most probably) be
46 // closed. This call is expected to always happen before the one to WasHidden.
47 void WillCloseTab();
43 48
44 // SnapshotController::Client 49 // SnapshotController::Client
45 void StartSnapshot() override; 50 void StartSnapshot() override;
46 51
47 // Delegate that is used by RecentTabHelper to get external dependencies. 52 // Delegate that is used by RecentTabHelper to get external dependencies.
48 // Default implementation lives in .cc file, while tests provide an override. 53 // Default implementation lives in .cc file, while tests provide an override.
49 class Delegate { 54 class Delegate {
50 public: 55 public:
51 virtual ~Delegate() {} 56 virtual ~Delegate() {}
52 virtual std::unique_ptr<OfflinePageArchiver> CreatePageArchiver( 57 virtual std::unique_ptr<OfflinePageArchiver> CreatePageArchiver(
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // is also used as an initialization flag for EnsureInitialized() to be run 142 // is also used as an initialization flag for EnsureInitialized() to be run
138 // only once. 143 // only once.
139 std::unique_ptr<SnapshotController> snapshot_controller_; 144 std::unique_ptr<SnapshotController> snapshot_controller_;
140 145
141 std::unique_ptr<Delegate> delegate_; 146 std::unique_ptr<Delegate> delegate_;
142 147
143 // Set at each navigation to control if last_n should save snapshots of the 148 // Set at each navigation to control if last_n should save snapshots of the
144 // current page being loaded. 149 // current page being loaded.
145 bool last_n_listen_to_tab_hidden_ = false; 150 bool last_n_listen_to_tab_hidden_ = false;
146 151
152 // Set to true when the tab containing the associated WebContents is in the
153 // process of being closed.
154 bool tab_is_closing = false;
Dmitry Titov 2017/02/24 01:49:38 Nit: add "_" at the end of the name.
carlosk 2017/02/24 02:06:35 Done.
155
147 base::WeakPtrFactory<RecentTabHelper> weak_ptr_factory_; 156 base::WeakPtrFactory<RecentTabHelper> weak_ptr_factory_;
148 157
149 DISALLOW_COPY_AND_ASSIGN(RecentTabHelper); 158 DISALLOW_COPY_AND_ASSIGN(RecentTabHelper);
150 }; 159 };
151 160
152 } // namespace offline_pages 161 } // namespace offline_pages
153 162
154 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ 163 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_bridge.cc ('k') | chrome/browser/android/offline_pages/recent_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698