| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/tab_contents/navigation_controller.h" | 5 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // get confused if we navigate back to it. | 47 // get confused if we navigate back to it. |
| 48 // | 48 // |
| 49 // An empty state is treated as a new navigation by WebKit, which would mean | 49 // An empty state is treated as a new navigation by WebKit, which would mean |
| 50 // losing the navigation entries and generating a new navigation entry after | 50 // losing the navigation entries and generating a new navigation entry after |
| 51 // this one. We don't want that. To avoid this we create a valid state which | 51 // this one. We don't want that. To avoid this we create a valid state which |
| 52 // WebKit will not treat as a new navigation. | 52 // WebKit will not treat as a new navigation. |
| 53 void SetContentStateIfEmpty(NavigationEntry* entry) { | 53 void SetContentStateIfEmpty(NavigationEntry* entry) { |
| 54 if (entry->content_state().empty() && | 54 if (entry->content_state().empty() && |
| 55 (entry->tab_type() == TAB_CONTENTS_WEB || | 55 (entry->tab_type() == TAB_CONTENTS_WEB || |
| 56 entry->tab_type() == TAB_CONTENTS_NEW_TAB_UI || | 56 entry->tab_type() == TAB_CONTENTS_NEW_TAB_UI || |
| 57 entry->tab_type() == TAB_CONTENTS_DOM_UI || |
| 57 entry->tab_type() == TAB_CONTENTS_ABOUT_UI || | 58 entry->tab_type() == TAB_CONTENTS_ABOUT_UI || |
| 58 entry->tab_type() == TAB_CONTENTS_HTML_DIALOG || | 59 entry->tab_type() == TAB_CONTENTS_HTML_DIALOG || |
| 59 entry->IsViewSourceMode())) { | 60 entry->IsViewSourceMode())) { |
| 60 entry->set_content_state( | 61 entry->set_content_state( |
| 61 webkit_glue::CreateHistoryStateForURL(entry->url())); | 62 webkit_glue::CreateHistoryStateForURL(entry->url())); |
| 62 } | 63 } |
| 63 } | 64 } |
| 64 | 65 |
| 65 // Configure all the NavigationEntries in entries for restore. This resets | 66 // Configure all the NavigationEntries in entries for restore. This resets |
| 66 // the transition type to reload and makes sure the content state isn't empty. | 67 // the transition type to reload and makes sure the content state isn't empty. |
| (...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1225 return i; | 1226 return i; |
| 1226 } | 1227 } |
| 1227 return -1; | 1228 return -1; |
| 1228 } | 1229 } |
| 1229 | 1230 |
| 1230 NavigationEntry* NavigationController::GetTransientEntry() const { | 1231 NavigationEntry* NavigationController::GetTransientEntry() const { |
| 1231 if (transient_entry_index_ == -1) | 1232 if (transient_entry_index_ == -1) |
| 1232 return NULL; | 1233 return NULL; |
| 1233 return entries_[transient_entry_index_].get(); | 1234 return entries_[transient_entry_index_].get(); |
| 1234 } | 1235 } |
| OLD | NEW |