OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sessions/tab_restore_service_helper.h" | 5 #include "chrome/browser/sessions/tab_restore_service_helper.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 controller->GetPendingEntry() : controller->GetEntryAtIndex(i); | 388 controller->GetPendingEntry() : controller->GetEntryAtIndex(i); |
389 tab->navigations[i] = | 389 tab->navigations[i] = |
390 TabNavigation::FromNavigationEntry(i, *entry); | 390 TabNavigation::FromNavigationEntry(i, *entry); |
391 } | 391 } |
392 tab->timestamp = TimeNow(); | 392 tab->timestamp = TimeNow(); |
393 tab->current_navigation_index = controller->GetCurrentEntryIndex(); | 393 tab->current_navigation_index = controller->GetCurrentEntryIndex(); |
394 if (tab->current_navigation_index == -1 && entry_count > 0) | 394 if (tab->current_navigation_index == -1 && entry_count > 0) |
395 tab->current_navigation_index = 0; | 395 tab->current_navigation_index = 0; |
396 tab->tabstrip_index = index; | 396 tab->tabstrip_index = index; |
397 | 397 |
398 TabContents* tab_contents = | 398 extensions::TabHelper* extensions_tab_helper = |
399 TabContents::FromWebContents(controller->GetWebContents()); | 399 extensions::TabHelper::FromWebContents(controller->GetWebContents()); |
400 // tab_contents is NULL in some browser tests. | 400 // extensions_tab_helper is NULL in some browser tests. |
401 if (tab_contents) { | 401 if (extensions_tab_helper) { |
402 const extensions::Extension* extension = | 402 const extensions::Extension* extension = |
403 extensions::TabHelper::FromWebContents(controller->GetWebContents())-> | 403 extensions_tab_helper->extension_app(); |
404 extension_app(); | |
405 if (extension) | 404 if (extension) |
406 tab->extension_app_id = extension->id(); | 405 tab->extension_app_id = extension->id(); |
407 } | 406 } |
408 | 407 |
409 tab->user_agent_override = | 408 tab->user_agent_override = |
410 controller->GetWebContents()->GetUserAgentOverride(); | 409 controller->GetWebContents()->GetUserAgentOverride(); |
411 | 410 |
412 // TODO(ajwong): This does not correctly handle storage for isolated apps. | 411 // TODO(ajwong): This does not correctly handle storage for isolated apps. |
413 tab->session_storage_namespace = | 412 tab->session_storage_namespace = |
414 controller->GetDefaultSessionStorageNamespace(); | 413 controller->GetDefaultSessionStorageNamespace(); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 Tab* tab = static_cast<Tab*>(entry); | 552 Tab* tab = static_cast<Tab*>(entry); |
554 if (tab->browser_id == old_id) | 553 if (tab->browser_id == old_id) |
555 tab->browser_id = new_id; | 554 tab->browser_id = new_id; |
556 } | 555 } |
557 } | 556 } |
558 } | 557 } |
559 | 558 |
560 base::Time TabRestoreServiceHelper::TimeNow() const { | 559 base::Time TabRestoreServiceHelper::TimeNow() const { |
561 return time_factory_ ? time_factory_->TimeNow() : base::Time::Now(); | 560 return time_factory_ ? time_factory_->TimeNow() : base::Time::Now(); |
562 } | 561 } |
OLD | NEW |