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

Side by Side Diff: components/offline_pages/core/snapshot_controller.h

Issue 2822023002: [Offline pages]: Move logic for whether to consider the DocumentAvailableInMainFrame signal to the … (Closed)
Patch Set: some fix Created 3 years, 8 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 COMPONENTS_OFFLINE_PAGES_CORE_SNAPSHOT_CONTROLLER_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_SNAPSHOT_CONTROLLER_H_
6 #define COMPONENTS_OFFLINE_PAGES_CORE_SNAPSHOT_CONTROLLER_H_ 6 #define COMPONENTS_OFFLINE_PAGES_CORE_SNAPSHOT_CONTROLLER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 virtual ~Client() {} 60 virtual ~Client() {}
61 }; 61 };
62 62
63 SnapshotController( 63 SnapshotController(
64 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 64 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
65 SnapshotController::Client* client); 65 SnapshotController::Client* client);
66 SnapshotController( 66 SnapshotController(
67 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 67 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
68 SnapshotController::Client* client, 68 SnapshotController::Client* client,
69 int64_t delay_after_document_available_ms, 69 int64_t delay_after_document_available_ms,
70 int64_t delay_after_document_on_load_completed_ms); 70 int64_t delay_after_document_on_load_completed_ms,
71 bool consider_document_available_for_snapshot);
71 virtual ~SnapshotController(); 72 virtual ~SnapshotController();
72 73
73 // Resets the 'session', returning controller to initial state. 74 // Resets the 'session', returning controller to initial state.
74 void Reset(); 75 void Reset();
75 76
76 // Stops current session, no more Client::StartSnapshot calls will be 77 // Stops current session, no more Client::StartSnapshot calls will be
77 // invoked from the SnapshotController until current session is Reset(). 78 // invoked from the SnapshotController until current session is Reset().
78 // Called by Client, for example when it encounters an error loading the page. 79 // Called by Client, for example when it encounters an error loading the page.
79 void Stop(); 80 void Stop();
80 81
(...skipping 15 matching lines...) Expand all
96 private: 97 private:
97 void MaybeStartSnapshot(PageQuality updated_page_quality); 98 void MaybeStartSnapshot(PageQuality updated_page_quality);
98 void MaybeStartSnapshotThenStop(); 99 void MaybeStartSnapshotThenStop();
99 100
100 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 101 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
101 // Client owns this class. 102 // Client owns this class.
102 SnapshotController::Client* client_; 103 SnapshotController::Client* client_;
103 SnapshotController::State state_; 104 SnapshotController::State state_;
104 int64_t delay_after_document_available_ms_; 105 int64_t delay_after_document_available_ms_;
105 int64_t delay_after_document_on_load_completed_ms_; 106 int64_t delay_after_document_on_load_completed_ms_;
107 bool consider_document_available_for_snapshot_;
carlosk 2017/04/19 23:16:57 nit: it seems to me that prefixing with "consider"
fgorski 2017/04/20 16:39:05 I too have hard time reading this variable: docum
chili 2017/04/21 00:12:54 I think I prefer a "positive" over "negative" link
carlosk 2017/04/21 01:10:58 It is. I find this naming to be just as clear as t
106 108
107 // The expected quality of a snapshot taken at the moment this value is 109 // The expected quality of a snapshot taken at the moment this value is
108 // queried. 110 // queried.
109 PageQuality current_page_quality_ = PageQuality::POOR; 111 PageQuality current_page_quality_ = PageQuality::POOR;
110 112
111 base::WeakPtrFactory<SnapshotController> weak_ptr_factory_; 113 base::WeakPtrFactory<SnapshotController> weak_ptr_factory_;
112 114
113 DISALLOW_COPY_AND_ASSIGN(SnapshotController); 115 DISALLOW_COPY_AND_ASSIGN(SnapshotController);
114 }; 116 };
115 117
116 } // namespace offline_pages 118 } // namespace offline_pages
117 119
118 #endif // COMPONENTS_OFFLINE_PAGES_CORE_SNAPSHOT_CONTROLLER_H_ 120 #endif // COMPONENTS_OFFLINE_PAGES_CORE_SNAPSHOT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698