OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gfx/text_elider.h" | 7 #include "app/gfx/text_elider.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 void TabContents::SetAppExtension(Extension* extension) { | 475 void TabContents::SetAppExtension(Extension* extension) { |
476 DCHECK(!extension || extension->IsApp()); | 476 DCHECK(!extension || extension->IsApp()); |
477 app_extension_ = extension; | 477 app_extension_ = extension; |
478 | 478 |
479 NotificationService::current()->Notify( | 479 NotificationService::current()->Notify( |
480 NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, | 480 NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, |
481 Source<TabContents>(this), | 481 Source<TabContents>(this), |
482 NotificationService::NoDetails()); | 482 NotificationService::NoDetails()); |
483 } | 483 } |
484 | 484 |
| 485 void TabContents::SetAppExtensionById(const std::string& app_extension_id) { |
| 486 if (app_extension_id.empty()) |
| 487 return; |
| 488 |
| 489 ExtensionsService* extension_service = profile()->GetExtensionsService(); |
| 490 if (extension_service && extension_service->is_ready()) { |
| 491 Extension* extension = |
| 492 extension_service->GetExtensionById(app_extension_id, false); |
| 493 if (extension) |
| 494 SetAppExtension(extension); |
| 495 } |
| 496 } |
| 497 |
485 const GURL& TabContents::GetURL() const { | 498 const GURL& TabContents::GetURL() const { |
486 // We may not have a navigation entry yet | 499 // We may not have a navigation entry yet |
487 NavigationEntry* entry = controller_.GetActiveEntry(); | 500 NavigationEntry* entry = controller_.GetActiveEntry(); |
488 return entry ? entry->virtual_url() : GURL::EmptyGURL(); | 501 return entry ? entry->virtual_url() : GURL::EmptyGURL(); |
489 } | 502 } |
490 | 503 |
491 const string16& TabContents::GetTitle() const { | 504 const string16& TabContents::GetTitle() const { |
492 // Transient entries take precedence. They are used for interstitial pages | 505 // Transient entries take precedence. They are used for interstitial pages |
493 // that are shown on top of existing pages. | 506 // that are shown on top of existing pages. |
494 NavigationEntry* entry = controller_.GetTransientEntry(); | 507 NavigationEntry* entry = controller_.GetTransientEntry(); |
(...skipping 2377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2872 } | 2885 } |
2873 | 2886 |
2874 void TabContents::set_encoding(const std::string& encoding) { | 2887 void TabContents::set_encoding(const std::string& encoding) { |
2875 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 2888 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
2876 } | 2889 } |
2877 | 2890 |
2878 void TabContents::SetAppIcon(const SkBitmap& app_icon) { | 2891 void TabContents::SetAppIcon(const SkBitmap& app_icon) { |
2879 app_icon_ = app_icon; | 2892 app_icon_ = app_icon; |
2880 NotifyNavigationStateChanged(INVALIDATE_TITLE); | 2893 NotifyNavigationStateChanged(INVALIDATE_TITLE); |
2881 } | 2894 } |
OLD | NEW |