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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 | 114 |
115 // Notification the window is about to close. | 115 // Notification the window is about to close. |
116 void WindowClosing(const SessionID& window_id); | 116 void WindowClosing(const SessionID& window_id); |
117 | 117 |
118 // Notification a window has finished closing. | 118 // Notification a window has finished closing. |
119 void WindowClosed(const SessionID& window_id); | 119 void WindowClosed(const SessionID& window_id); |
120 | 120 |
121 // Sets the type of window. In order for the contents of a window to be | 121 // Sets the type of window. In order for the contents of a window to be |
122 // tracked SetWindowType must be invoked with a type we track | 122 // tracked SetWindowType must be invoked with a type we track |
123 // (should_track_changes_for_browser_type returns true). | 123 // (should_track_changes_for_browser_type returns true). |
124 void SetWindowType(const SessionID& window_id, Browser::Type type); | 124 void SetWindowType(const SessionID& window_id, |
125 Browser::Type type, | |
sky
2012/02/24 20:56:04
Use an enum for the boolean (can also be used in s
DaveMoore
2012/02/25 16:54:42
Done.
| |
126 bool is_app); | |
127 | |
128 // Sets the application name of the specified window. | |
129 void SetWindowAppName(const SessionID& window_id, | |
130 const std::string& app_name); | |
125 | 131 |
126 // Invoked when the NavigationController has removed entries from the back of | 132 // Invoked when the NavigationController has removed entries from the back of |
127 // the list. |count| gives the number of entries in the navigation controller. | 133 // the list. |count| gives the number of entries in the navigation controller. |
128 void TabNavigationPathPrunedFromBack(const SessionID& window_id, | 134 void TabNavigationPathPrunedFromBack(const SessionID& window_id, |
129 const SessionID& tab_id, | 135 const SessionID& tab_id, |
130 int count); | 136 int count); |
131 | 137 |
132 // Invoked when the NavigationController has removed entries from the front of | 138 // Invoked when the NavigationController has removed entries from the front of |
133 // the list. |count| gives the number of entries that were removed. | 139 // the list. |count| gives the number of entries that were removed. |
134 void TabNavigationPathPrunedFromFront(const SessionID& window_id, | 140 void TabNavigationPathPrunedFromFront(const SessionID& window_id, |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 // Returns true if there are open trackable browser windows whose ids do | 361 // Returns true if there are open trackable browser windows whose ids do |
356 // match |window_id| with our profile. A trackable window is a window from | 362 // match |window_id| with our profile. A trackable window is a window from |
357 // which |should_track_changes_for_browser_type| returns true. See | 363 // which |should_track_changes_for_browser_type| returns true. See |
358 // |should_track_changes_for_browser_type| for details. | 364 // |should_track_changes_for_browser_type| for details. |
359 bool HasOpenTrackableBrowsers(const SessionID& window_id); | 365 bool HasOpenTrackableBrowsers(const SessionID& window_id); |
360 | 366 |
361 // Returns true if changes to tabs in the specified window should be tracked. | 367 // Returns true if changes to tabs in the specified window should be tracked. |
362 bool ShouldTrackChangesToWindow(const SessionID& window_id); | 368 bool ShouldTrackChangesToWindow(const SessionID& window_id); |
363 | 369 |
364 // Returns true if we track changes to the specified browser type. | 370 // Returns true if we track changes to the specified browser type. |
365 static bool should_track_changes_for_browser_type(Browser::Type type); | 371 static bool should_track_changes_for_browser_type( |
372 Browser::Type type, | |
373 bool is_app); | |
366 | 374 |
367 // Returns true if we should record a window close as pending. | 375 // Returns true if we should record a window close as pending. |
368 // |has_open_trackable_browsers_| must be up-to-date before calling this. | 376 // |has_open_trackable_browsers_| must be up-to-date before calling this. |
369 bool should_record_close_as_pending() const { | 377 bool should_record_close_as_pending() const { |
370 // When this is called, the browser window being closed is still open, hence | 378 // When this is called, the browser window being closed is still open, hence |
371 // still in the browser list. If there is a browser window other than the | 379 // still in the browser list. If there is a browser window other than the |
372 // one being closed but no trackable windows, then the others must be App | 380 // one being closed but no trackable windows, then the others must be App |
373 // windows or similar. In this case, we record the close as pending. | 381 // windows or similar. In this case, we record the close as pending. |
374 return !has_open_trackable_browsers_ && | 382 return !has_open_trackable_browsers_ && |
375 (!browser_defaults::kBrowserAliveWithNoWindows || | 383 (!browser_defaults::kBrowserAliveWithNoWindows || |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
445 | 453 |
446 // Constants used in calculating histogram data. | 454 // Constants used in calculating histogram data. |
447 const base::TimeDelta save_delay_in_millis_; | 455 const base::TimeDelta save_delay_in_millis_; |
448 const base::TimeDelta save_delay_in_mins_; | 456 const base::TimeDelta save_delay_in_mins_; |
449 const base::TimeDelta save_delay_in_hrs_; | 457 const base::TimeDelta save_delay_in_hrs_; |
450 | 458 |
451 DISALLOW_COPY_AND_ASSIGN(SessionService); | 459 DISALLOW_COPY_AND_ASSIGN(SessionService); |
452 }; | 460 }; |
453 | 461 |
454 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ | 462 #endif // CHROME_BROWSER_SESSIONS_SESSION_SERVICE_H_ |
OLD | NEW |