| 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 "webkit/tools/test_shell/test_navigation_controller.h" | 5 #include "webkit/tools/test_shell/test_navigation_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "webkit/glue/webhistoryitem.h" | 8 #include "webkit/glue/webhistoryitem.h" |
| 9 #include "webkit/tools/test_shell/test_shell.h" | 9 #include "webkit/tools/test_shell/test_shell.h" |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 TestNavigationEntry::~TestNavigationEntry() { | 28 TestNavigationEntry::~TestNavigationEntry() { |
| 29 } | 29 } |
| 30 | 30 |
| 31 void TestNavigationEntry::SetContentState(const std::string& state) { | 31 void TestNavigationEntry::SetContentState(const std::string& state) { |
| 32 cached_history_item_ = NULL; // invalidate our cached item | 32 cached_history_item_ = NULL; // invalidate our cached item |
| 33 state_ = state; | 33 state_ = state; |
| 34 } | 34 } |
| 35 | 35 |
| 36 WebHistoryItem* TestNavigationEntry::GetHistoryItem() const { | 36 WebHistoryItem* TestNavigationEntry::GetHistoryItem() const { |
| 37 #if not defined(OS_LINUX) // TODO(port): temporary hack. |
| 37 if (!cached_history_item_) { | 38 if (!cached_history_item_) { |
| 38 TestShellExtraRequestData* extra_data = | 39 TestShellExtraRequestData* extra_data = |
| 39 new TestShellExtraRequestData(GetPageID()); | 40 new TestShellExtraRequestData(GetPageID()); |
| 40 cached_history_item_ = | 41 cached_history_item_ = |
| 41 WebHistoryItem::Create(GetURL(), GetTitle(), GetContentState(), | 42 WebHistoryItem::Create(GetURL(), GetTitle(), GetContentState(), |
| 42 extra_data); | 43 extra_data); |
| 43 } | 44 } |
| 45 #endif |
| 44 return cached_history_item_; | 46 return cached_history_item_; |
| 45 } | 47 } |
| 46 | 48 |
| 47 // ---------------------------------------------------------------------------- | 49 // ---------------------------------------------------------------------------- |
| 48 // TestNavigationController | 50 // TestNavigationController |
| 49 | 51 |
| 50 TestNavigationController::TestNavigationController(TestShell* shell) | 52 TestNavigationController::TestNavigationController(TestShell* shell) |
| 51 : pending_entry_(NULL), | 53 : pending_entry_(NULL), |
| 52 last_committed_entry_index_(-1), | 54 last_committed_entry_index_(-1), |
| 53 pending_entry_index_(-1), | 55 pending_entry_index_(-1), |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 DiscardPendingEntry(); | 240 DiscardPendingEntry(); |
| 239 } | 241 } |
| 240 } | 242 } |
| 241 | 243 |
| 242 void TestNavigationController::UpdateMaxPageID() { | 244 void TestNavigationController::UpdateMaxPageID() { |
| 243 TestNavigationEntry* entry = GetActiveEntry(); | 245 TestNavigationEntry* entry = GetActiveEntry(); |
| 244 if (entry) | 246 if (entry) |
| 245 max_page_id_ = std::max(max_page_id_, entry->GetPageID()); | 247 max_page_id_ = std::max(max_page_id_, entry->GetPageID()); |
| 246 } | 248 } |
| 247 | 249 |
| OLD | NEW |