| 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/renderer/frame_sniffer.h" | 5 #include "chrome/renderer/frame_sniffer.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/common/render_messages.h" | 8 #include "chrome/common/render_messages.h" |
| 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLError.h" | 9 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 11 | 11 |
| 12 FrameSniffer::FrameSniffer(content::RenderView* render_view, | 12 FrameSniffer::FrameSniffer(content::RenderView* render_view, |
| 13 const string16 &unique_frame_name) | 13 const string16 &unique_frame_name) |
| 14 : content::RenderViewObserver(render_view), | 14 : content::RenderViewObserver(render_view), |
| 15 unique_frame_name_(unique_frame_name) { | 15 unique_frame_name_(unique_frame_name) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 FrameSniffer::~FrameSniffer() { | 18 FrameSniffer::~FrameSniffer() { |
| 19 } | 19 } |
| 20 | 20 |
| 21 void FrameSniffer::DidFailProvisionalLoad(WebKit::WebFrame* frame, | 21 void FrameSniffer::DidFailProvisionalLoad(WebKit::WebFrame* frame, |
| 22 const WebKit::WebURLError& error) { | 22 const WebKit::WebURLError& error) { |
| 23 if (!ShouldSniffFrame(frame)) | 23 if (!ShouldSniffFrame(frame)) |
| 24 return; | 24 return; |
| 25 Send(new ChromeViewHostMsg_FrameLoadingError(routing_id(), -error.reason)); | 25 Send(new ChromeViewHostMsg_FrameLoadingError(routing_id(), -error.reason)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void FrameSniffer::DidCommitProvisionalLoad(WebKit::WebFrame* frame, | 28 void FrameSniffer::DidCommitProvisionalLoad(WebKit::WebFrame* frame, |
| 29 bool is_new_navigation) { | 29 bool is_new_navigation) { |
| 30 if (!ShouldSniffFrame(frame)) | 30 if (!ShouldSniffFrame(frame)) |
| 31 return; | 31 return; |
| 32 Send(new ChromeViewHostMsg_FrameLoadingCompleted(routing_id())); | 32 Send(new ChromeViewHostMsg_FrameLoadingCompleted(routing_id())); |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool FrameSniffer::ShouldSniffFrame(WebKit::WebFrame* frame) { | 35 bool FrameSniffer::ShouldSniffFrame(WebKit::WebFrame* frame) { |
| 36 return frame->uniqueName() == unique_frame_name_; | 36 return frame->uniqueName() == unique_frame_name_; |
| 37 } | 37 } |
| OLD | NEW |