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 22 matching lines...) Expand all Loading... |
33 #include "chrome/browser/content_settings/host_content_settings_map.h" | 33 #include "chrome/browser/content_settings/host_content_settings_map.h" |
34 #include "chrome/browser/debugger/devtools_manager.h" | 34 #include "chrome/browser/debugger/devtools_manager.h" |
35 #include "chrome/browser/defaults.h" | 35 #include "chrome/browser/defaults.h" |
36 #include "chrome/browser/dom_operation_notification_details.h" | 36 #include "chrome/browser/dom_operation_notification_details.h" |
37 #include "chrome/browser/dom_ui/dom_ui.h" | 37 #include "chrome/browser/dom_ui/dom_ui.h" |
38 #include "chrome/browser/dom_ui/dom_ui_factory.h" | 38 #include "chrome/browser/dom_ui/dom_ui_factory.h" |
39 #include "chrome/browser/download/download_item_model.h" | 39 #include "chrome/browser/download/download_item_model.h" |
40 #include "chrome/browser/download/download_manager.h" | 40 #include "chrome/browser/download/download_manager.h" |
41 #include "chrome/browser/download/download_request_limiter.h" | 41 #include "chrome/browser/download/download_request_limiter.h" |
42 #include "chrome/browser/external_protocol_handler.h" | 42 #include "chrome/browser/external_protocol_handler.h" |
43 #include "chrome/browser/extensions/extensions_service.h" | 43 #include "chrome/browser/extensions/extension_service.h" |
44 #include "chrome/browser/history/history_types.h" | 44 #include "chrome/browser/history/history_types.h" |
45 #include "chrome/browser/history/top_sites.h" | 45 #include "chrome/browser/history/top_sites.h" |
46 #include "chrome/browser/host_zoom_map.h" | 46 #include "chrome/browser/host_zoom_map.h" |
47 #include "chrome/browser/favicon_service.h" | 47 #include "chrome/browser/favicon_service.h" |
48 #include "chrome/browser/file_select_helper.h" | 48 #include "chrome/browser/file_select_helper.h" |
49 #include "chrome/browser/google/google_util.h" | 49 #include "chrome/browser/google/google_util.h" |
50 #include "chrome/browser/hung_renderer_dialog.h" | 50 #include "chrome/browser/hung_renderer_dialog.h" |
51 #include "chrome/browser/in_process_webkit/session_storage_namespace.h" | 51 #include "chrome/browser/in_process_webkit/session_storage_namespace.h" |
52 #include "chrome/browser/load_from_memory_cache_details.h" | 52 #include "chrome/browser/load_from_memory_cache_details.h" |
53 #include "chrome/browser/load_notification_details.h" | 53 #include "chrome/browser/load_notification_details.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 NotificationService::current()->Notify( | 589 NotificationService::current()->Notify( |
590 NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, | 590 NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, |
591 Source<TabContents>(this), | 591 Source<TabContents>(this), |
592 NotificationService::NoDetails()); | 592 NotificationService::NoDetails()); |
593 } | 593 } |
594 | 594 |
595 void TabContents::SetExtensionAppById(const std::string& extension_app_id) { | 595 void TabContents::SetExtensionAppById(const std::string& extension_app_id) { |
596 if (extension_app_id.empty()) | 596 if (extension_app_id.empty()) |
597 return; | 597 return; |
598 | 598 |
599 ExtensionsService* extension_service = profile()->GetExtensionsService(); | 599 ExtensionService* extension_service = profile()->GetExtensionService(); |
600 if (!extension_service || !extension_service->is_ready()) | 600 if (!extension_service || !extension_service->is_ready()) |
601 return; | 601 return; |
602 | 602 |
603 const Extension* extension = | 603 const Extension* extension = |
604 extension_service->GetExtensionById(extension_app_id, false); | 604 extension_service->GetExtensionById(extension_app_id, false); |
605 if (extension) | 605 if (extension) |
606 SetExtensionApp(extension); | 606 SetExtensionApp(extension); |
607 } | 607 } |
608 | 608 |
609 SkBitmap* TabContents::GetExtensionAppIcon() { | 609 SkBitmap* TabContents::GetExtensionAppIcon() { |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 | 1678 |
1679 // Allow the new page to set the title again. | 1679 // Allow the new page to set the title again. |
1680 received_page_title_ = false; | 1680 received_page_title_ = false; |
1681 | 1681 |
1682 // Get the favicon, either from history or request it from the net. | 1682 // Get the favicon, either from history or request it from the net. |
1683 fav_icon_helper_.FetchFavIcon(details.entry->url()); | 1683 fav_icon_helper_.FetchFavIcon(details.entry->url()); |
1684 | 1684 |
1685 // Clear all page actions, blocked content notifications and browser actions | 1685 // Clear all page actions, blocked content notifications and browser actions |
1686 // for this tab, unless this is an in-page navigation. | 1686 // for this tab, unless this is an in-page navigation. |
1687 if (!details.is_in_page) { | 1687 if (!details.is_in_page) { |
1688 ExtensionsService* service = profile()->GetExtensionsService(); | 1688 ExtensionService* service = profile()->GetExtensionService(); |
1689 if (service) { | 1689 if (service) { |
1690 for (size_t i = 0; i < service->extensions()->size(); ++i) { | 1690 for (size_t i = 0; i < service->extensions()->size(); ++i) { |
1691 ExtensionAction* browser_action = | 1691 ExtensionAction* browser_action = |
1692 service->extensions()->at(i)->browser_action(); | 1692 service->extensions()->at(i)->browser_action(); |
1693 if (browser_action) { | 1693 if (browser_action) { |
1694 browser_action->ClearAllValuesForTab(controller().session_id().id()); | 1694 browser_action->ClearAllValuesForTab(controller().session_id().id()); |
1695 NotificationService::current()->Notify( | 1695 NotificationService::current()->Notify( |
1696 NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, | 1696 NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, |
1697 Source<ExtensionAction>(browser_action), | 1697 Source<ExtensionAction>(browser_action), |
1698 NotificationService::NoDetails()); | 1698 NotificationService::NoDetails()); |
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3237 ExtensionIconSet::MATCH_EXACTLY), | 3237 ExtensionIconSet::MATCH_EXACTLY), |
3238 gfx::Size(Extension::EXTENSION_ICON_SMALLISH, | 3238 gfx::Size(Extension::EXTENSION_ICON_SMALLISH, |
3239 Extension::EXTENSION_ICON_SMALLISH), | 3239 Extension::EXTENSION_ICON_SMALLISH), |
3240 ImageLoadingTracker::CACHE); | 3240 ImageLoadingTracker::CACHE); |
3241 } else { | 3241 } else { |
3242 extension_app_image_loader_.reset(NULL); | 3242 extension_app_image_loader_.reset(NULL); |
3243 } | 3243 } |
3244 } | 3244 } |
3245 | 3245 |
3246 const Extension* TabContents::GetExtensionContaining(const GURL& url) { | 3246 const Extension* TabContents::GetExtensionContaining(const GURL& url) { |
3247 ExtensionsService* extensions_service = profile()->GetExtensionsService(); | 3247 ExtensionService* extensions_service = profile()->GetExtensionService(); |
3248 if (!extensions_service) | 3248 if (!extensions_service) |
3249 return NULL; | 3249 return NULL; |
3250 | 3250 |
3251 const Extension* extension = extensions_service->GetExtensionByURL(url); | 3251 const Extension* extension = extensions_service->GetExtensionByURL(url); |
3252 return extension ? | 3252 return extension ? |
3253 extension : extensions_service->GetExtensionByWebExtent(url); | 3253 extension : extensions_service->GetExtensionByWebExtent(url); |
3254 } | 3254 } |
3255 | 3255 |
3256 void TabContents::OnImageLoaded(SkBitmap* image, ExtensionResource resource, | 3256 void TabContents::OnImageLoaded(SkBitmap* image, ExtensionResource resource, |
3257 int index) { | 3257 int index) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3302 } | 3302 } |
3303 | 3303 |
3304 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 3304 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
3305 render_manager_.SwapInRenderViewHost(rvh); | 3305 render_manager_.SwapInRenderViewHost(rvh); |
3306 } | 3306 } |
3307 | 3307 |
3308 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 3308 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
3309 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 3309 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
3310 rwh_view->SetSize(view()->GetContainerSize()); | 3310 rwh_view->SetSize(view()->GetContainerSize()); |
3311 } | 3311 } |
OLD | NEW |