OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "chrome/browser/tab_contents/thumbnail_generator.h" | 43 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
44 #include "chrome/browser/thumbnail_store.h" | 44 #include "chrome/browser/thumbnail_store.h" |
45 #include "chrome/browser/search_engines/template_url_fetcher.h" | 45 #include "chrome/browser/search_engines/template_url_fetcher.h" |
46 #include "chrome/browser/search_engines/template_url_model.h" | 46 #include "chrome/browser/search_engines/template_url_model.h" |
47 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
48 #include "chrome/common/notification_service.h" | 48 #include "chrome/common/notification_service.h" |
49 #include "chrome/common/page_action.h" | 49 #include "chrome/common/page_action.h" |
50 #include "chrome/common/pref_names.h" | 50 #include "chrome/common/pref_names.h" |
51 #include "chrome/common/pref_service.h" | 51 #include "chrome/common/pref_service.h" |
52 #include "chrome/common/render_messages.h" | 52 #include "chrome/common/render_messages.h" |
| 53 #include "chrome/common/renderer_preferences.h" |
53 #include "chrome/common/url_constants.h" | 54 #include "chrome/common/url_constants.h" |
54 #include "grit/generated_resources.h" | 55 #include "grit/generated_resources.h" |
55 #include "grit/locale_settings.h" | 56 #include "grit/locale_settings.h" |
56 #include "net/base/mime_util.h" | 57 #include "net/base/mime_util.h" |
57 #include "net/base/net_errors.h" | 58 #include "net/base/net_errors.h" |
58 #include "net/base/net_util.h" | 59 #include "net/base/net_util.h" |
59 #include "net/base/registry_controlled_domain.h" | 60 #include "net/base/registry_controlled_domain.h" |
| 61 #include "webkit/glue/password_form.h" |
| 62 #include "webkit/glue/webpreferences.h" |
60 | 63 |
61 #if defined(OS_WIN) | 64 #if defined(OS_WIN) |
62 // For CRect | 65 // For CRect |
63 #include <atlbase.h> | 66 #include <atlbase.h> |
64 #include <atlapp.h> | 67 #include <atlapp.h> |
65 #include <atlmisc.h> | 68 #include <atlmisc.h> |
66 // TODO(port): some of these headers should be ported. | 69 // TODO(port): some of these headers should be ported. |
67 #include "chrome/browser/modal_html_dialog_delegate.h" | 70 #include "chrome/browser/modal_html_dialog_delegate.h" |
68 #include "views/controls/scrollbar/native_scroll_bar.h" | 71 #include "views/controls/scrollbar/native_scroll_bar.h" |
69 #endif | 72 #endif |
(...skipping 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2132 | 2135 |
2133 void TabContents::OnCrossSiteResponse(int new_render_process_host_id, | 2136 void TabContents::OnCrossSiteResponse(int new_render_process_host_id, |
2134 int new_request_id) { | 2137 int new_request_id) { |
2135 // Allows the TabContents to react when a cross-site response is ready to be | 2138 // Allows the TabContents to react when a cross-site response is ready to be |
2136 // delivered to a pending RenderViewHost. We must first run the onunload | 2139 // delivered to a pending RenderViewHost. We must first run the onunload |
2137 // handler of the old RenderViewHost before we can allow it to proceed. | 2140 // handler of the old RenderViewHost before we can allow it to proceed. |
2138 render_manager_.OnCrossSiteResponse(new_render_process_host_id, | 2141 render_manager_.OnCrossSiteResponse(new_render_process_host_id, |
2139 new_request_id); | 2142 new_request_id); |
2140 } | 2143 } |
2141 | 2144 |
| 2145 void TabContents::OnCrossSiteNavigationCanceled() { |
| 2146 render_manager_.CrossSiteNavigationCanceled(); |
| 2147 } |
| 2148 |
2142 bool TabContents::CanBlur() const { | 2149 bool TabContents::CanBlur() const { |
2143 return delegate() ? delegate()->CanBlur() : true; | 2150 return delegate() ? delegate()->CanBlur() : true; |
2144 } | 2151 } |
2145 | 2152 |
2146 gfx::Rect TabContents::GetRootWindowResizerRect() const { | 2153 gfx::Rect TabContents::GetRootWindowResizerRect() const { |
2147 if (delegate()) | 2154 if (delegate()) |
2148 return delegate()->GetRootWindowResizerRect(); | 2155 return delegate()->GetRootWindowResizerRect(); |
2149 return gfx::Rect(); | 2156 return gfx::Rect(); |
2150 } | 2157 } |
2151 | 2158 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2204 } | 2211 } |
2205 | 2212 |
2206 void TabContents::OnUserGesture() { | 2213 void TabContents::OnUserGesture() { |
2207 // See comment in RenderViewHostDelegate::OnUserGesture as to why we do this. | 2214 // See comment in RenderViewHostDelegate::OnUserGesture as to why we do this. |
2208 DownloadRequestManager* drm = g_browser_process->download_request_manager(); | 2215 DownloadRequestManager* drm = g_browser_process->download_request_manager(); |
2209 if (drm) | 2216 if (drm) |
2210 drm->OnUserGesture(this); | 2217 drm->OnUserGesture(this); |
2211 controller_.OnUserGesture(); | 2218 controller_.OnUserGesture(); |
2212 } | 2219 } |
2213 | 2220 |
| 2221 bool TabContents::IsExternalTabContainer() const { |
| 2222 if (!delegate()) |
| 2223 return false; |
| 2224 |
| 2225 return delegate()->IsExternalTabContainer(); |
| 2226 } |
| 2227 |
2214 void TabContents::OnFindReply(int request_id, | 2228 void TabContents::OnFindReply(int request_id, |
2215 int number_of_matches, | 2229 int number_of_matches, |
2216 const gfx::Rect& selection_rect, | 2230 const gfx::Rect& selection_rect, |
2217 int active_match_ordinal, | 2231 int active_match_ordinal, |
2218 bool final_update) { | 2232 bool final_update) { |
2219 // Ignore responses for requests other than the one we have most recently | 2233 // Ignore responses for requests other than the one we have most recently |
2220 // issued. That way we won't act on stale results when the user has | 2234 // issued. That way we won't act on stale results when the user has |
2221 // already typed in another query. | 2235 // already typed in another query. |
2222 if (request_id != current_find_request_id_) | 2236 if (request_id != current_find_request_id_) |
2223 return; | 2237 return; |
(...skipping 11 matching lines...) Expand all Loading... |
2235 // found. | 2249 // found. |
2236 last_search_result_ = FindNotificationDetails(request_id, number_of_matches, | 2250 last_search_result_ = FindNotificationDetails(request_id, number_of_matches, |
2237 selection, active_match_ordinal, | 2251 selection, active_match_ordinal, |
2238 final_update); | 2252 final_update); |
2239 NotificationService::current()->Notify( | 2253 NotificationService::current()->Notify( |
2240 NotificationType::FIND_RESULT_AVAILABLE, | 2254 NotificationType::FIND_RESULT_AVAILABLE, |
2241 Source<TabContents>(this), | 2255 Source<TabContents>(this), |
2242 Details<FindNotificationDetails>(&last_search_result_)); | 2256 Details<FindNotificationDetails>(&last_search_result_)); |
2243 } | 2257 } |
2244 | 2258 |
2245 bool TabContents::IsExternalTabContainer() const { | 2259 void TabContents::DidInsertCSS() { |
2246 if (!delegate()) | 2260 // This RVHDelegate function is used for extensions and not us. |
2247 return false; | |
2248 | |
2249 return delegate()->IsExternalTabContainer(); | |
2250 } | 2261 } |
2251 | 2262 |
2252 void TabContents::FileSelected(const FilePath& path, | 2263 void TabContents::FileSelected(const FilePath& path, |
2253 int index, void* params) { | 2264 int index, void* params) { |
2254 render_view_host()->FileSelected(path); | 2265 render_view_host()->FileSelected(path); |
2255 } | 2266 } |
2256 | 2267 |
2257 void TabContents::MultiFilesSelected(const std::vector<FilePath>& files, | 2268 void TabContents::MultiFilesSelected(const std::vector<FilePath>& files, |
2258 void* params) { | 2269 void* params) { |
2259 render_view_host()->MultiFilesSelected(files); | 2270 render_view_host()->MultiFilesSelected(files); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2346 NavigationController::LoadCommittedDetails& committed_details = | 2357 NavigationController::LoadCommittedDetails& committed_details = |
2347 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); | 2358 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); |
2348 ExpireInfoBars(committed_details); | 2359 ExpireInfoBars(committed_details); |
2349 break; | 2360 break; |
2350 } | 2361 } |
2351 | 2362 |
2352 default: | 2363 default: |
2353 NOTREACHED(); | 2364 NOTREACHED(); |
2354 } | 2365 } |
2355 } | 2366 } |
OLD | NEW |