Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(513)

Side by Side Diff: chrome/browser/tab_contents/interstitial_page.cc

Issue 40095: Enable interstitial pages for SSL certificate errors on Linux. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ssl/ssl_blocking_page.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/interstitial_page.h" 5 #include "chrome/browser/tab_contents/interstitial_page.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/thread.h" 8 #include "base/thread.h"
9 #include "chrome/browser/browser.h" 9 #include "chrome/browser/browser.h"
10 #include "chrome/browser/browser_list.h" 10 #include "chrome/browser/browser_list.h"
11 #include "chrome/browser/dom_operation_notification_details.h" 11 #include "chrome/browser/dom_operation_notification_details.h"
12 #include "chrome/browser/tab_contents/navigation_controller.h" 12 #include "chrome/browser/tab_contents/navigation_controller.h"
13 #include "chrome/browser/tab_contents/navigation_entry.h" 13 #include "chrome/browser/tab_contents/navigation_entry.h"
14 #include "chrome/browser/tab_contents/web_contents.h" 14 #include "chrome/browser/tab_contents/web_contents.h"
15 #include "chrome/common/notification_service.h" 15 #include "chrome/common/notification_service.h"
16 #include "chrome/views/window_delegate.h" 16 #include "chrome/views/window_delegate.h"
17 #include "grit/browser_resources.h" 17 #include "grit/browser_resources.h"
18 #include "net/base/escape.h" 18 #include "net/base/escape.h"
19 19
20 #if defined(OS_WIN) 20 #if defined(OS_WIN)
21 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" 21 #include "chrome/browser/renderer_host/render_widget_host_view_win.h"
22 #include "chrome/browser/tab_contents/web_contents_view_win.h" 22 #include "chrome/browser/tab_contents/web_contents_view_win.h"
23 #include "chrome/views/window.h" 23 #include "chrome/views/window.h"
24 #else
25 #include "chrome/browser/renderer_host/render_widget_host_view.h"
26 #include "chrome/browser/tab_contents/web_contents_view.h"
24 #endif 27 #endif
25 28
26 namespace { 29 namespace {
27 30
28 class ResourceRequestTask : public Task { 31 class ResourceRequestTask : public Task {
29 public: 32 public:
30 ResourceRequestTask(int process_id, 33 ResourceRequestTask(int process_id,
31 int render_view_host_id, 34 int render_view_host_id,
32 ResourceRequestAction action) 35 ResourceRequestAction action)
33 : action_(action), 36 : action_(action),
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 view->set_parent_hwnd(tab_->GetContentNativeView()); 259 view->set_parent_hwnd(tab_->GetContentNativeView());
257 WebContentsViewWin* web_contents_view = 260 WebContentsViewWin* web_contents_view =
258 static_cast<WebContentsViewWin*>(tab_->view()); 261 static_cast<WebContentsViewWin*>(tab_->view());
259 render_view_host->AllowDomAutomationBindings(); 262 render_view_host->AllowDomAutomationBindings();
260 render_view_host->CreateRenderView(); 263 render_view_host->CreateRenderView();
261 // SetSize must be called after CreateRenderView or the HWND won't show. 264 // SetSize must be called after CreateRenderView or the HWND won't show.
262 view->SetSize(web_contents_view->GetContainerSize()); 265 view->SetSize(web_contents_view->GetContainerSize());
263 266
264 return render_view_host; 267 return render_view_host;
265 #else 268 #else
266 // TODO(port): RenderWidgetHost* is implemented, but Create and 269 // It is untested, whether this code is sufficiently generic that it
267 // set_parent_hwnd are specific to RenderWidgetHostWin, so this should 270 // works with Windows, and thus obsoletes the special-cased code above.
268 // probably be refactored. 271 // If it does work, don't forget to also clean up the include statements!
269 NOTIMPLEMENTED(); 272 NOTIMPLEMENTED();
270 return NULL; 273
274 RenderViewHost* render_view_host = new RenderViewHost(
275 SiteInstance::CreateSiteInstance(tab()->profile()),
276 this, MSG_ROUTING_NONE, NULL);
277 WebContentsView* web_contents_view = tab()->view();
278 RenderWidgetHostView* view =
279 web_contents_view->CreateViewForWidget(render_view_host);
280 render_view_host->set_view(view);
281 render_view_host->AllowDomAutomationBindings();
282 render_view_host->CreateRenderView();
283 view->SetSize(web_contents_view->GetContainerSize());
284 return render_view_host;
271 #endif 285 #endif
272 } 286 }
273 287
274 void InterstitialPage::Proceed() { 288 void InterstitialPage::Proceed() {
275 if (action_taken_) { 289 if (action_taken_) {
276 NOTREACHED(); 290 NOTREACHED();
277 return; 291 return;
278 } 292 }
279 Disable(); 293 Disable();
280 action_taken_ = true; 294 action_taken_ = true;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 #endif 355 #endif
342 } 356 }
343 357
344 Profile* InterstitialPage::GetProfile() const { 358 Profile* InterstitialPage::GetProfile() const {
345 return tab_->profile(); 359 return tab_->profile();
346 } 360 }
347 361
348 void InterstitialPage::DidNavigate( 362 void InterstitialPage::DidNavigate(
349 RenderViewHost* render_view_host, 363 RenderViewHost* render_view_host,
350 const ViewHostMsg_FrameNavigate_Params& params) { 364 const ViewHostMsg_FrameNavigate_Params& params) {
351 #if defined(OS_WIN)
352 // A fast user could have navigated away from the page that triggered the 365 // A fast user could have navigated away from the page that triggered the
353 // interstitial while the interstitial was loading, that would have disabled 366 // interstitial while the interstitial was loading, that would have disabled
354 // us. In that case we can dismiss ourselves. 367 // us. In that case we can dismiss ourselves.
355 if (!enabled_){ 368 if (!enabled_){
356 DontProceed(); 369 DontProceed();
357 return; 370 return;
358 } 371 }
359 372
360 // The RenderViewHost has loaded its contents, we can show it now. 373 // The RenderViewHost has loaded its contents, we can show it now.
361 render_view_host_->view()->Show(); 374 render_view_host_->view()->Show();
362 tab_->set_interstitial_page(this); 375 tab_->set_interstitial_page(this);
363 376
364 // Notify the tab we are not loading so the throbber is stopped. It also 377 // Notify the tab we are not loading so the throbber is stopped. It also
365 // causes a NOTIFY_LOAD_STOP notification, that the AutomationProvider (used 378 // causes a NOTIFY_LOAD_STOP notification, that the AutomationProvider (used
366 // by the UI tests) expects to consider a navigation as complete. Without this , 379 // by the UI tests) expects to consider a navigation as complete. Without this ,
367 // navigating in a UI test to a URL that triggers an interstitial would hang. 380 // navigating in a UI test to a URL that triggers an interstitial would hang.
368 tab_->SetIsLoading(false, NULL); 381 tab_->SetIsLoading(false, NULL);
369 #else
370 // TODO(port): we need RenderViewHost.
371 NOTIMPLEMENTED();
372 #endif
373 } 382 }
374 383
375 void InterstitialPage::RenderViewGone(RenderViewHost* render_view_host) { 384 void InterstitialPage::RenderViewGone(RenderViewHost* render_view_host) {
376 // Our renderer died. This should not happen in normal cases. 385 // Our renderer died. This should not happen in normal cases.
377 // Just dismiss the interstitial. 386 // Just dismiss the interstitial.
378 DontProceed(); 387 DontProceed();
379 } 388 }
380 389
381 void InterstitialPage::DomOperationResponse(const std::string& json_string, 390 void InterstitialPage::DomOperationResponse(const std::string& json_string,
382 int automation_id) { 391 int automation_id) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 514
506 void InterstitialPage::InterstitialPageRVHViewDelegate:: 515 void InterstitialPage::InterstitialPageRVHViewDelegate::
507 ForwardMessageToDevToolsClient(const IPC::Message& message) { 516 ForwardMessageToDevToolsClient(const IPC::Message& message) {
508 NOTREACHED() << "InterstitialPage does not support developer tools content."; 517 NOTREACHED() << "InterstitialPage does not support developer tools content.";
509 } 518 }
510 519
511 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( 520 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply(
512 int request_id, int number_of_matches, const gfx::Rect& selection_rect, 521 int request_id, int number_of_matches, const gfx::Rect& selection_rect,
513 int active_match_ordinal, bool final_update) { 522 int active_match_ordinal, bool final_update) {
514 } 523 }
515
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_blocking_page.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698