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...) Loading... |
33 #include "chrome/browser/debugger/devtools_manager.h" | 33 #include "chrome/browser/debugger/devtools_manager.h" |
34 #include "chrome/browser/defaults.h" | 34 #include "chrome/browser/defaults.h" |
35 #include "chrome/browser/dom_operation_notification_details.h" | 35 #include "chrome/browser/dom_operation_notification_details.h" |
36 #include "chrome/browser/dom_ui/dom_ui.h" | 36 #include "chrome/browser/dom_ui/dom_ui.h" |
37 #include "chrome/browser/dom_ui/dom_ui_factory.h" | 37 #include "chrome/browser/dom_ui/dom_ui_factory.h" |
38 #include "chrome/browser/download/download_item_model.h" | 38 #include "chrome/browser/download/download_item_model.h" |
39 #include "chrome/browser/download/download_manager.h" | 39 #include "chrome/browser/download/download_manager.h" |
40 #include "chrome/browser/download/download_request_limiter.h" | 40 #include "chrome/browser/download/download_request_limiter.h" |
41 #include "chrome/browser/external_protocol_handler.h" | 41 #include "chrome/browser/external_protocol_handler.h" |
42 #include "chrome/browser/extensions/extension_service.h" | 42 #include "chrome/browser/extensions/extension_service.h" |
| 43 #include "chrome/browser/history/history.h" |
43 #include "chrome/browser/history/history_types.h" | 44 #include "chrome/browser/history/history_types.h" |
44 #include "chrome/browser/history/top_sites.h" | 45 #include "chrome/browser/history/top_sites.h" |
45 #include "chrome/browser/host_zoom_map.h" | 46 #include "chrome/browser/host_zoom_map.h" |
46 #include "chrome/browser/favicon_service.h" | 47 #include "chrome/browser/favicon_service.h" |
47 #include "chrome/browser/file_select_helper.h" | 48 #include "chrome/browser/file_select_helper.h" |
48 #include "chrome/browser/google/google_util.h" | 49 #include "chrome/browser/google/google_util.h" |
49 #include "chrome/browser/hung_renderer_dialog.h" | 50 #include "chrome/browser/hung_renderer_dialog.h" |
50 #include "chrome/browser/in_process_webkit/session_storage_namespace.h" | 51 #include "chrome/browser/in_process_webkit/session_storage_namespace.h" |
51 #include "chrome/browser/load_from_memory_cache_details.h" | 52 #include "chrome/browser/load_from_memory_cache_details.h" |
52 #include "chrome/browser/load_notification_details.h" | 53 #include "chrome/browser/load_notification_details.h" |
(...skipping 39 matching lines...) Loading... |
92 #include "chrome/common/extensions/extension_resource.h" | 93 #include "chrome/common/extensions/extension_resource.h" |
93 #include "chrome/common/extensions/url_pattern.h" | 94 #include "chrome/common/extensions/url_pattern.h" |
94 #include "chrome/common/navigation_types.h" | 95 #include "chrome/common/navigation_types.h" |
95 #include "chrome/common/net/url_request_context_getter.h" | 96 #include "chrome/common/net/url_request_context_getter.h" |
96 #include "chrome/common/notification_service.h" | 97 #include "chrome/common/notification_service.h" |
97 #include "chrome/common/pref_names.h" | 98 #include "chrome/common/pref_names.h" |
98 #include "chrome/common/render_messages.h" | 99 #include "chrome/common/render_messages.h" |
99 #include "chrome/common/render_messages_params.h" | 100 #include "chrome/common/render_messages_params.h" |
100 #include "chrome/common/renderer_preferences.h" | 101 #include "chrome/common/renderer_preferences.h" |
101 #include "chrome/common/url_constants.h" | 102 #include "chrome/common/url_constants.h" |
| 103 #include "gfx/codec/png_codec.h" |
102 #include "grit/chromium_strings.h" | 104 #include "grit/chromium_strings.h" |
103 #include "grit/generated_resources.h" | 105 #include "grit/generated_resources.h" |
104 #include "grit/locale_settings.h" | 106 #include "grit/locale_settings.h" |
105 #include "grit/platform_locale_settings.h" | 107 #include "grit/platform_locale_settings.h" |
106 #include "grit/theme_resources.h" | 108 #include "grit/theme_resources.h" |
107 #include "net/base/mime_util.h" | 109 #include "net/base/mime_util.h" |
108 #include "net/base/net_errors.h" | 110 #include "net/base/net_errors.h" |
109 #include "net/base/net_util.h" | 111 #include "net/base/net_util.h" |
110 #include "net/base/registry_controlled_domain.h" | 112 #include "net/base/registry_controlled_domain.h" |
111 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 113 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
(...skipping 852 matching lines...) Loading... |
964 | 966 |
965 void TabContents::ShowPageInfo(const GURL& url, | 967 void TabContents::ShowPageInfo(const GURL& url, |
966 const NavigationEntry::SSLStatus& ssl, | 968 const NavigationEntry::SSLStatus& ssl, |
967 bool show_history) { | 969 bool show_history) { |
968 if (!delegate_) | 970 if (!delegate_) |
969 return; | 971 return; |
970 | 972 |
971 delegate_->ShowPageInfo(profile(), url, ssl, show_history); | 973 delegate_->ShowPageInfo(profile(), url, ssl, show_history); |
972 } | 974 } |
973 | 975 |
| 976 void TabContents::SaveFavicon() { |
| 977 NavigationEntry* entry = controller_.GetActiveEntry(); |
| 978 if (!entry || entry->url().is_empty()) |
| 979 return; |
| 980 |
| 981 // Make sure the page is in history, otherwise adding the favicon does |
| 982 // nothing. |
| 983 HistoryService* history = profile()->GetOriginalProfile()->GetHistoryService( |
| 984 Profile::IMPLICIT_ACCESS); |
| 985 if (!history) |
| 986 return; |
| 987 history->AddPageNoVisitForBookmark(entry->url()); |
| 988 |
| 989 FaviconService* service = profile()->GetOriginalProfile()->GetFaviconService( |
| 990 Profile::IMPLICIT_ACCESS); |
| 991 if (!service) |
| 992 return; |
| 993 const NavigationEntry::FaviconStatus& favicon(entry->favicon()); |
| 994 if (!favicon.is_valid() || favicon.url().is_empty() || |
| 995 favicon.bitmap().empty()) { |
| 996 return; |
| 997 } |
| 998 std::vector<unsigned char> image_data; |
| 999 gfx::PNGCodec::EncodeBGRASkBitmap(favicon.bitmap(), false, &image_data); |
| 1000 service->SetFavicon(entry->url(), favicon.url(), image_data); |
| 1001 } |
| 1002 |
974 ConstrainedWindow* TabContents::CreateConstrainedDialog( | 1003 ConstrainedWindow* TabContents::CreateConstrainedDialog( |
975 ConstrainedWindowDelegate* delegate) { | 1004 ConstrainedWindowDelegate* delegate) { |
976 ConstrainedWindow* window = | 1005 ConstrainedWindow* window = |
977 ConstrainedWindow::CreateConstrainedDialog(this, delegate); | 1006 ConstrainedWindow::CreateConstrainedDialog(this, delegate); |
978 child_windows_.push_back(window); | 1007 child_windows_.push_back(window); |
979 | 1008 |
980 if (child_windows_.size() == 1) { | 1009 if (child_windows_.size() == 1) { |
981 window->ShowConstrainedWindow(); | 1010 window->ShowConstrainedWindow(); |
982 BlockTabContent(true); | 1011 BlockTabContent(true); |
983 } | 1012 } |
(...skipping 2317 matching lines...) Loading... |
3301 } | 3330 } |
3302 | 3331 |
3303 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 3332 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
3304 render_manager_.SwapInRenderViewHost(rvh); | 3333 render_manager_.SwapInRenderViewHost(rvh); |
3305 } | 3334 } |
3306 | 3335 |
3307 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 3336 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
3308 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 3337 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
3309 rwh_view->SetSize(view()->GetContainerSize()); | 3338 rwh_view->SetSize(view()->GetContainerSize()); |
3310 } | 3339 } |
OLD | NEW |