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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
579 TabContentsSSLHelper* TabContents::GetSSLHelper() { | 579 TabContentsSSLHelper* TabContents::GetSSLHelper() { |
580 if (ssl_helper_.get() == NULL) | 580 if (ssl_helper_.get() == NULL) |
581 ssl_helper_.reset(new TabContentsSSLHelper(this)); | 581 ssl_helper_.reset(new TabContentsSSLHelper(this)); |
582 return ssl_helper_.get(); | 582 return ssl_helper_.get(); |
583 } | 583 } |
584 | 584 |
585 RenderProcessHost* TabContents::GetRenderProcessHost() const { | 585 RenderProcessHost* TabContents::GetRenderProcessHost() const { |
586 return render_manager_.current_host()->process(); | 586 return render_manager_.current_host()->process(); |
587 } | 587 } |
588 | 588 |
589 bool TabContents::IsInstalledApp() const { | |
590 ExtensionsService* extension_service = profile()->GetExtensionsService(); | |
591 | |
592 // Check for hosted app. | |
593 if (extension_service->GetExtensionByWebExtent(GetURL()) != NULL) | |
594 return true; | |
595 | |
596 // Check for packaged app. | |
597 const Extension* extension = | |
598 extension_service->GetExtensionById(GetURL().host(), false); | |
Erik does not do reviews
2010/12/02 01:05:17
use GetExtensionByURL instead (no need to use .hos
Charlie Reis
2010/12/02 01:45:43
Ah, nice. I should have noticed that one.
| |
599 return extension != NULL && extension->is_app(); | |
600 } | |
601 | |
589 void TabContents::SetExtensionApp(const Extension* extension) { | 602 void TabContents::SetExtensionApp(const Extension* extension) { |
590 DCHECK(!extension || extension->GetFullLaunchURL().is_valid()); | 603 DCHECK(!extension || extension->GetFullLaunchURL().is_valid()); |
591 extension_app_ = extension; | 604 extension_app_ = extension; |
592 | 605 |
593 UpdateExtensionAppIcon(extension_app_); | 606 UpdateExtensionAppIcon(extension_app_); |
594 | 607 |
595 NotificationService::current()->Notify( | 608 NotificationService::current()->Notify( |
596 NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, | 609 NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, |
597 Source<TabContents>(this), | 610 Source<TabContents>(this), |
598 NotificationService::NoDetails()); | 611 NotificationService::NoDetails()); |
(...skipping 2641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3240 } | 3253 } |
3241 | 3254 |
3242 void TabContents::set_encoding(const std::string& encoding) { | 3255 void TabContents::set_encoding(const std::string& encoding) { |
3243 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 3256 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
3244 } | 3257 } |
3245 | 3258 |
3246 void TabContents::SetAppIcon(const SkBitmap& app_icon) { | 3259 void TabContents::SetAppIcon(const SkBitmap& app_icon) { |
3247 app_icon_ = app_icon; | 3260 app_icon_ = app_icon; |
3248 NotifyNavigationStateChanged(INVALIDATE_TITLE); | 3261 NotifyNavigationStateChanged(INVALIDATE_TITLE); |
3249 } | 3262 } |
OLD | NEW |