OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 #include "chrome/browser/printing/print_preview_tab_controller.h" | 56 #include "chrome/browser/printing/print_preview_tab_controller.h" |
57 #include "chrome/browser/printing/print_view_manager.h" | 57 #include "chrome/browser/printing/print_view_manager.h" |
58 #include "chrome/browser/profiles/profile.h" | 58 #include "chrome/browser/profiles/profile.h" |
59 #include "chrome/browser/renderer_host/render_process_host.h" | 59 #include "chrome/browser/renderer_host/render_process_host.h" |
60 #include "chrome/browser/renderer_host/render_view_host.h" | 60 #include "chrome/browser/renderer_host/render_view_host.h" |
61 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 61 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
62 #include "chrome/browser/renderer_host/resource_request_details.h" | 62 #include "chrome/browser/renderer_host/resource_request_details.h" |
63 #include "chrome/browser/renderer_host/site_instance.h" | 63 #include "chrome/browser/renderer_host/site_instance.h" |
64 #include "chrome/browser/renderer_host/web_cache_manager.h" | 64 #include "chrome/browser/renderer_host/web_cache_manager.h" |
65 #include "chrome/browser/renderer_preferences_util.h" | 65 #include "chrome/browser/renderer_preferences_util.h" |
66 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | |
66 #include "chrome/browser/search_engines/template_url.h" | 67 #include "chrome/browser/search_engines/template_url.h" |
67 #include "chrome/browser/search_engines/template_url_fetcher.h" | 68 #include "chrome/browser/search_engines/template_url_fetcher.h" |
68 #include "chrome/browser/search_engines/template_url_fetcher_ui_callbacks.h" | 69 #include "chrome/browser/search_engines/template_url_fetcher_ui_callbacks.h" |
69 #include "chrome/browser/search_engines/template_url_model.h" | 70 #include "chrome/browser/search_engines/template_url_model.h" |
70 #include "chrome/browser/sessions/session_types.h" | 71 #include "chrome/browser/sessions/session_types.h" |
71 #include "chrome/browser/tab_contents/infobar_delegate.h" | 72 #include "chrome/browser/tab_contents/infobar_delegate.h" |
72 #include "chrome/browser/tab_contents/interstitial_page.h" | 73 #include "chrome/browser/tab_contents/interstitial_page.h" |
73 #include "chrome/browser/tab_contents/navigation_entry.h" | 74 #include "chrome/browser/tab_contents/navigation_entry.h" |
74 #include "chrome/browser/tab_contents/provisional_load_details.h" | 75 #include "chrome/browser/tab_contents/provisional_load_details.h" |
75 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 76 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
(...skipping 3071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3147 minimum_zoom_percent_ = minimum_percent; | 3148 minimum_zoom_percent_ = minimum_percent; |
3148 maximum_zoom_percent_ = maximum_percent; | 3149 maximum_zoom_percent_ = maximum_percent; |
3149 temporary_zoom_settings_ = !remember; | 3150 temporary_zoom_settings_ = !remember; |
3150 } | 3151 } |
3151 | 3152 |
3152 void TabContents::UpdateContentRestrictions(int restrictions) { | 3153 void TabContents::UpdateContentRestrictions(int restrictions) { |
3153 content_restrictions_ = restrictions; | 3154 content_restrictions_ = restrictions; |
3154 delegate()->ContentRestrictionsChanged(this); | 3155 delegate()->ContentRestrictionsChanged(this); |
3155 } | 3156 } |
3156 | 3157 |
3158 void TabContents::DetectedPhishingSite(const GURL& phishing_url, | |
3159 double phishing_score) { | |
3160 // There is something seriously wrong if there is no service class but | |
3161 // this method is called. The renderer should not start phishing detection | |
3162 // if there isn't any service class in the browser. | |
Brian Ryner
2011/01/20 23:36:40
Checking this is still a good idea though, since w
noelutz
2011/02/10 01:16:23
Yeah. Good point.
| |
3163 safe_browsing::ClientSideDetectionService* service = | |
3164 g_browser_process->safe_browsing_detection_service(); | |
3165 DCHECK(service); | |
3166 if (service) { | |
3167 // The client object will delete itself once nobody needs it anymore. | |
3168 safe_browsing::CsdClient* client = new safe_browsing::CsdClient( | |
3169 GetRenderProcessHost()->id(), render_view_host()->routing_id()); | |
3170 | |
3171 // If the user navigates away from the current page we want to know about it | |
3172 // so that we won't show an interstitial. Note: we remove the client as an | |
3173 // observer in MaybeShowPhishingInterstitial. | |
3174 AddNavigationObserver(client); | |
3175 | |
3176 service->SendClientReportPhishingRequest( | |
3177 phishing_url, | |
3178 phishing_score, | |
3179 NewCallback(client, | |
3180 &safe_browsing::CsdClient::MaybeShowPhishingInterstitial)); | |
3181 } | |
3182 } | |
3183 | |
3157 void TabContents::BeforeUnloadFiredFromRenderManager( | 3184 void TabContents::BeforeUnloadFiredFromRenderManager( |
3158 bool proceed, | 3185 bool proceed, |
3159 bool* proceed_to_fire_unload) { | 3186 bool* proceed_to_fire_unload) { |
3160 if (delegate()) | 3187 if (delegate()) |
3161 delegate()->BeforeUnloadFired(this, proceed, proceed_to_fire_unload); | 3188 delegate()->BeforeUnloadFired(this, proceed, proceed_to_fire_unload); |
3162 } | 3189 } |
3163 | 3190 |
3164 void TabContents::DidStartLoadingFromRenderManager( | 3191 void TabContents::DidStartLoadingFromRenderManager( |
3165 RenderViewHost* render_view_host) { | 3192 RenderViewHost* render_view_host) { |
3166 DidStartLoading(); | 3193 DidStartLoading(); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3378 } | 3405 } |
3379 | 3406 |
3380 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 3407 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
3381 render_manager_.SwapInRenderViewHost(rvh); | 3408 render_manager_.SwapInRenderViewHost(rvh); |
3382 } | 3409 } |
3383 | 3410 |
3384 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 3411 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
3385 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 3412 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
3386 rwh_view->SetSize(view()->GetContainerSize()); | 3413 rwh_view->SetSize(view()->GetContainerSize()); |
3387 } | 3414 } |
OLD | NEW |