OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_SESSIONS_SESSION_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
6 #define CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ | 6 #define CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 TYPE_POPUP = 1 | 192 TYPE_POPUP = 1 |
193 }; | 193 }; |
194 | 194 |
195 void Init(); | 195 void Init(); |
196 | 196 |
197 // Implementation of RestoreIfNecessary. If |browser| is non-null and we need | 197 // Implementation of RestoreIfNecessary. If |browser| is non-null and we need |
198 // to restore, the tabs are added to it, otherwise a new browser is created. | 198 // to restore, the tabs are added to it, otherwise a new browser is created. |
199 bool RestoreIfNecessary(const std::vector<GURL>& urls_to_open, | 199 bool RestoreIfNecessary(const std::vector<GURL>& urls_to_open, |
200 Browser* browser); | 200 Browser* browser); |
201 | 201 |
202 virtual void Observe(NotificationType type, | 202 virtual void Observe(int type, |
203 const NotificationSource& source, | 203 const NotificationSource& source, |
204 const NotificationDetails& details); | 204 const NotificationDetails& details); |
205 | 205 |
206 // Sets the application extension id of the specified tab. | 206 // Sets the application extension id of the specified tab. |
207 void SetTabExtensionAppID(const SessionID& window_id, | 207 void SetTabExtensionAppID(const SessionID& window_id, |
208 const SessionID& tab_id, | 208 const SessionID& tab_id, |
209 const std::string& extension_app_id); | 209 const std::string& extension_app_id); |
210 | 210 |
211 // Methods to create the various commands. It is up to the caller to delete | 211 // Methods to create the various commands. It is up to the caller to delete |
212 // the returned the SessionCommand* object. | 212 // the returned the SessionCommand* object. |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 return !has_open_trackable_browsers_ && | 374 return !has_open_trackable_browsers_ && |
375 (!browser_defaults::kBrowserAliveWithNoWindows || | 375 (!browser_defaults::kBrowserAliveWithNoWindows || |
376 BrowserList::size() > 1); | 376 BrowserList::size() > 1); |
377 } | 377 } |
378 | 378 |
379 // Call when certain session relevant notifications | 379 // Call when certain session relevant notifications |
380 // (tab_closed, nav_list_pruned) occur. In addition, this is | 380 // (tab_closed, nav_list_pruned) occur. In addition, this is |
381 // currently called when Save() is called to compare how often the | 381 // currently called when Save() is called to compare how often the |
382 // session data is currently saved verses when we may want to save it. | 382 // session data is currently saved verses when we may want to save it. |
383 // It records the data in UMA stats. | 383 // It records the data in UMA stats. |
384 void RecordSessionUpdateHistogramData(NotificationType type, | 384 void RecordSessionUpdateHistogramData(int type, |
385 base::TimeTicks* last_updated_time); | 385 base::TimeTicks* last_updated_time); |
386 | 386 |
387 // Helper methods to record the histogram data | 387 // Helper methods to record the histogram data |
388 void RecordUpdatedTabClosed(base::TimeDelta delta, bool use_long_period); | 388 void RecordUpdatedTabClosed(base::TimeDelta delta, bool use_long_period); |
389 void RecordUpdatedNavListPruned(base::TimeDelta delta, bool use_long_period); | 389 void RecordUpdatedNavListPruned(base::TimeDelta delta, bool use_long_period); |
390 void RecordUpdatedNavEntryCommit(base::TimeDelta delta, bool use_long_period); | 390 void RecordUpdatedNavEntryCommit(base::TimeDelta delta, bool use_long_period); |
391 void RecordUpdatedSaveTime(base::TimeDelta delta, bool use_long_period); | 391 void RecordUpdatedSaveTime(base::TimeDelta delta, bool use_long_period); |
392 void RecordUpdatedSessionNavigationOrTab(base::TimeDelta delta, | 392 void RecordUpdatedSessionNavigationOrTab(base::TimeDelta delta, |
393 bool use_long_period); | 393 bool use_long_period); |
394 | 394 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 | 445 |
446 // Constants used in calculating histogram data. | 446 // Constants used in calculating histogram data. |
447 const base::TimeDelta save_delay_in_millis_; | 447 const base::TimeDelta save_delay_in_millis_; |
448 const base::TimeDelta save_delay_in_mins_; | 448 const base::TimeDelta save_delay_in_mins_; |
449 const base::TimeDelta save_delay_in_hrs_; | 449 const base::TimeDelta save_delay_in_hrs_; |
450 | 450 |
451 DISALLOW_COPY_AND_ASSIGN(SessionService); | 451 DISALLOW_COPY_AND_ASSIGN(SessionService); |
452 }; | 452 }; |
453 | 453 |
454 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ | 454 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
OLD | NEW |