| 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_TYPES_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ |
| 6 #define CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ | 6 #define CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "chrome/browser/sessions/session_id.h" | 15 #include "chrome/browser/sessions/session_id.h" |
| 16 #include "content/public/common/page_transition_types.h" | 16 #include "content/public/common/page_transition_types.h" |
| 17 #include "content/public/common/referrer.h" |
| 17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 18 #include "ui/base/ui_base_types.h" | 19 #include "ui/base/ui_base_types.h" |
| 19 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
| 20 | 21 |
| 21 class NavigationEntry; | 22 class NavigationEntry; |
| 22 class Profile; | 23 class Profile; |
| 23 | 24 |
| 24 // TabNavigation ------------------------------------------------------------- | 25 // TabNavigation ------------------------------------------------------------- |
| 25 | 26 |
| 26 // TabNavigation corresponds to the parts of NavigationEntry needed to restore | 27 // TabNavigation corresponds to the parts of NavigationEntry needed to restore |
| 27 // the NavigationEntry during session restore and tab restore. | 28 // the NavigationEntry during session restore and tab restore. |
| 28 // | 29 // |
| 29 // TabNavigation is cheap and supports copy semantics. | 30 // TabNavigation is cheap and supports copy semantics. |
| 30 class TabNavigation { | 31 class TabNavigation { |
| 31 public: | 32 public: |
| 32 enum TypeMask { | 33 enum TypeMask { |
| 33 HAS_POST_DATA = 1 | 34 HAS_POST_DATA = 1 |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 TabNavigation(); | 37 TabNavigation(); |
| 37 TabNavigation(int index, | 38 TabNavigation(int index, |
| 38 const GURL& virtual_url, | 39 const GURL& virtual_url, |
| 39 const GURL& referrer, | 40 const content::Referrer& referrer, |
| 40 const string16& title, | 41 const string16& title, |
| 41 const std::string& state, | 42 const std::string& state, |
| 42 content::PageTransition transition); | 43 content::PageTransition transition); |
| 43 TabNavigation(const TabNavigation& tab); | 44 TabNavigation(const TabNavigation& tab); |
| 44 ~TabNavigation(); | 45 ~TabNavigation(); |
| 45 TabNavigation& operator=(const TabNavigation& tab); | 46 TabNavigation& operator=(const TabNavigation& tab); |
| 46 | 47 |
| 47 // Converts this TabNavigation into a NavigationEntry with a page id of | 48 // Converts this TabNavigation into a NavigationEntry with a page id of |
| 48 // |page_id|. The caller owns the returned NavigationEntry. | 49 // |page_id|. The caller owns the returned NavigationEntry. |
| 49 NavigationEntry* ToNavigationEntry(int page_id, Profile* profile) const; | 50 NavigationEntry* ToNavigationEntry(int page_id, Profile* profile) const; |
| 50 | 51 |
| 51 // Resets this TabNavigation from |entry|. | 52 // Resets this TabNavigation from |entry|. |
| 52 void SetFromNavigationEntry(const NavigationEntry& entry); | 53 void SetFromNavigationEntry(const NavigationEntry& entry); |
| 53 | 54 |
| 54 // Virtual URL of the page. See NavigationEntry::virtual_url() for details. | 55 // Virtual URL of the page. See NavigationEntry::virtual_url() for details. |
| 55 void set_virtual_url(const GURL& url) { virtual_url_ = url; } | 56 void set_virtual_url(const GURL& url) { virtual_url_ = url; } |
| 56 const GURL& virtual_url() const { return virtual_url_; } | 57 const GURL& virtual_url() const { return virtual_url_; } |
| 57 | 58 |
| 58 // The referrer. | 59 // The referrer. |
| 59 const GURL& referrer() const { return referrer_; } | 60 const content::Referrer& referrer() const { return referrer_; } |
| 60 | 61 |
| 61 // The title of the page. | 62 // The title of the page. |
| 62 void set_title(const string16& title) { title_ = title; } | 63 void set_title(const string16& title) { title_ = title; } |
| 63 const string16& title() const { return title_; } | 64 const string16& title() const { return title_; } |
| 64 | 65 |
| 65 // State bits. | 66 // State bits. |
| 66 const std::string& state() const { return state_; } | 67 const std::string& state() const { return state_; } |
| 67 | 68 |
| 68 // Transition type. | 69 // Transition type. |
| 69 void set_transition(content::PageTransition transition) { | 70 void set_transition(content::PageTransition transition) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 88 // caller owns the NavigationEntrys. | 89 // caller owns the NavigationEntrys. |
| 89 static void CreateNavigationEntriesFromTabNavigations( | 90 static void CreateNavigationEntriesFromTabNavigations( |
| 90 Profile* profile, | 91 Profile* profile, |
| 91 const std::vector<TabNavigation>& navigations, | 92 const std::vector<TabNavigation>& navigations, |
| 92 std::vector<NavigationEntry*>* entries); | 93 std::vector<NavigationEntry*>* entries); |
| 93 | 94 |
| 94 private: | 95 private: |
| 95 friend class BaseSessionService; | 96 friend class BaseSessionService; |
| 96 | 97 |
| 97 GURL virtual_url_; | 98 GURL virtual_url_; |
| 98 GURL referrer_; | 99 content::Referrer referrer_; |
| 99 string16 title_; | 100 string16 title_; |
| 100 std::string state_; | 101 std::string state_; |
| 101 content::PageTransition transition_; | 102 content::PageTransition transition_; |
| 102 int type_mask_; | 103 int type_mask_; |
| 103 | 104 |
| 104 int index_; | 105 int index_; |
| 105 }; | 106 }; |
| 106 | 107 |
| 107 // SessionTab ---------------------------------------------------------------- | 108 // SessionTab ---------------------------------------------------------------- |
| 108 | 109 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 std::vector<SessionTab*> tabs; | 193 std::vector<SessionTab*> tabs; |
| 193 | 194 |
| 194 // Is the window maximized, minimized, or normal? | 195 // Is the window maximized, minimized, or normal? |
| 195 ui::WindowShowState show_state; | 196 ui::WindowShowState show_state; |
| 196 | 197 |
| 197 private: | 198 private: |
| 198 DISALLOW_COPY_AND_ASSIGN(SessionWindow); | 199 DISALLOW_COPY_AND_ASSIGN(SessionWindow); |
| 199 }; | 200 }; |
| 200 | 201 |
| 201 #endif // CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ | 202 #endif // CHROME_BROWSER_SESSIONS_SESSION_TYPES_H_ |
| OLD | NEW |