| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 if (plugin_installer_.get() == NULL) | 444 if (plugin_installer_.get() == NULL) |
| 445 plugin_installer_.reset(new PluginInstaller(this)); | 445 plugin_installer_.reset(new PluginInstaller(this)); |
| 446 return plugin_installer_.get(); | 446 return plugin_installer_.get(); |
| 447 } | 447 } |
| 448 | 448 |
| 449 const GURL& TabContents::GetURL() const { | 449 const GURL& TabContents::GetURL() const { |
| 450 // We may not have a navigation entry yet | 450 // We may not have a navigation entry yet |
| 451 NavigationEntry* entry = controller_.GetActiveEntry(); | 451 NavigationEntry* entry = controller_.GetActiveEntry(); |
| 452 return entry ? entry->virtual_url() : GURL::EmptyGURL(); | 452 return entry ? entry->virtual_url() : GURL::EmptyGURL(); |
| 453 } | 453 } |
| 454 void TabContents::NotifyRenderViewHostSwitchedFromRenderManager( |
| 455 RenderViewHostSwitchedDetails*details) { |
| 454 | 456 |
| 457 NotificationService::current()->Notify( |
| 458 NotificationType::RENDER_VIEW_HOST_CHANGED, |
| 459 Source<NavigationController>( |
| 460 &controller_), |
| 461 Details<RenderViewHostSwitchedDetails>(details)); |
| 462 } |
| 455 const string16& TabContents::GetTitle() const { | 463 const string16& TabContents::GetTitle() const { |
| 456 // Transient entries take precedence. They are used for interstitial pages | 464 // Transient entries take precedence. They are used for interstitial pages |
| 457 // that are shown on top of existing pages. | 465 // that are shown on top of existing pages. |
| 458 NavigationEntry* entry = controller_.GetTransientEntry(); | 466 NavigationEntry* entry = controller_.GetTransientEntry(); |
| 459 if (entry) | 467 if (entry) |
| 460 return entry->GetTitleForDisplay(&controller_); | 468 return entry->GetTitleForDisplay(&controller_); |
| 461 | 469 |
| 462 DOMUI* our_dom_ui = render_manager_.pending_dom_ui() ? | 470 DOMUI* our_dom_ui = render_manager_.pending_dom_ui() ? |
| 463 render_manager_.pending_dom_ui() : render_manager_.dom_ui(); | 471 render_manager_.pending_dom_ui() : render_manager_.dom_ui(); |
| 464 if (our_dom_ui) { | 472 if (our_dom_ui) { |
| (...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2026 NavigationEntry* entry = controller_.GetEntryWithPageID(GetSiteInstance(), | 2034 NavigationEntry* entry = controller_.GetEntryWithPageID(GetSiteInstance(), |
| 2027 page_id); | 2035 page_id); |
| 2028 if (!entry || !UpdateTitleForEntry(entry, title)) | 2036 if (!entry || !UpdateTitleForEntry(entry, title)) |
| 2029 return; | 2037 return; |
| 2030 | 2038 |
| 2031 // Broadcast notifications when the UI should be updated. | 2039 // Broadcast notifications when the UI should be updated. |
| 2032 if (entry == controller_.GetEntryAtOffset(0)) | 2040 if (entry == controller_.GetEntryAtOffset(0)) |
| 2033 NotifyNavigationStateChanged(INVALIDATE_TAB); | 2041 NotifyNavigationStateChanged(INVALIDATE_TAB); |
| 2034 } | 2042 } |
| 2035 | 2043 |
| 2044 NavigationEntry*TabContents::GetEntryAtOffsetForRenderManager(int offset) { |
| 2045 return controller_.GetEntryAtOffset(offset); |
| 2046 } |
| 2047 |
| 2036 void TabContents::UpdateEncoding(RenderViewHost* render_view_host, | 2048 void TabContents::UpdateEncoding(RenderViewHost* render_view_host, |
| 2037 const std::string& encoding) { | 2049 const std::string& encoding) { |
| 2038 set_encoding(encoding); | 2050 set_encoding(encoding); |
| 2039 } | 2051 } |
| 2040 | 2052 |
| 2041 void TabContents::UpdateTargetURL(int32 page_id, const GURL& url) { | 2053 void TabContents::UpdateTargetURL(int32 page_id, const GURL& url) { |
| 2042 if (delegate()) | 2054 if (delegate()) |
| 2043 delegate()->UpdateTargetURL(this, url); | 2055 delegate()->UpdateTargetURL(this, url); |
| 2044 } | 2056 } |
| 2045 | 2057 |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2526 | 2538 |
| 2527 default: | 2539 default: |
| 2528 NOTREACHED(); | 2540 NOTREACHED(); |
| 2529 } | 2541 } |
| 2530 } | 2542 } |
| 2531 | 2543 |
| 2532 void TabContents::set_encoding(const std::string& encoding) { | 2544 void TabContents::set_encoding(const std::string& encoding) { |
| 2533 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 2545 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
| 2534 } | 2546 } |
| 2535 | 2547 |
| OLD | NEW |