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 <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, | 591 NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, |
592 Source<TabContents>(this), | 592 Source<TabContents>(this), |
593 NotificationService::NoDetails()); | 593 NotificationService::NoDetails()); |
594 } | 594 } |
595 | 595 |
596 void TabContents::SetExtensionAppById(const std::string& extension_app_id) { | 596 void TabContents::SetExtensionAppById(const std::string& extension_app_id) { |
597 if (extension_app_id.empty()) | 597 if (extension_app_id.empty()) |
598 return; | 598 return; |
599 | 599 |
600 ExtensionsService* extension_service = profile()->GetExtensionsService(); | 600 ExtensionsService* extension_service = profile()->GetExtensionsService(); |
601 const Extension* extension = | 601 if (extension_service && extension_service->is_ready()) { |
602 extension_service->GetExtensionById(extension_app_id, false); | 602 const Extension* extension = |
603 if (extension) | 603 extension_service->GetExtensionById(extension_app_id, false); |
604 SetExtensionApp(extension); | 604 if (extension) |
| 605 SetExtensionApp(extension); |
| 606 } |
605 } | 607 } |
606 | 608 |
607 SkBitmap* TabContents::GetExtensionAppIcon() { | 609 SkBitmap* TabContents::GetExtensionAppIcon() { |
608 if (extension_app_icon_.empty()) | 610 if (extension_app_icon_.empty()) |
609 return NULL; | 611 return NULL; |
610 | 612 |
611 return &extension_app_icon_; | 613 return &extension_app_icon_; |
612 } | 614 } |
613 | 615 |
614 const GURL& TabContents::GetURL() const { | 616 const GURL& TabContents::GetURL() const { |
(...skipping 2599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3214 } | 3216 } |
3215 | 3217 |
3216 void TabContents::set_encoding(const std::string& encoding) { | 3218 void TabContents::set_encoding(const std::string& encoding) { |
3217 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 3219 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
3218 } | 3220 } |
3219 | 3221 |
3220 void TabContents::SetAppIcon(const SkBitmap& app_icon) { | 3222 void TabContents::SetAppIcon(const SkBitmap& app_icon) { |
3221 app_icon_ = app_icon; | 3223 app_icon_ = app_icon; |
3222 NotifyNavigationStateChanged(INVALIDATE_TITLE); | 3224 NotifyNavigationStateChanged(INVALIDATE_TITLE); |
3223 } | 3225 } |
OLD | NEW |