OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/guestview/adview/adview_guest.h" | 5 #include "chrome/browser/guestview/adview/adview_guest.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "chrome/browser/guestview/adview/adview_constants.h" | 8 #include "chrome/browser/guestview/adview/adview_constants.h" |
9 #include "chrome/browser/guestview/guestview_constants.h" | 9 #include "chrome/browser/guestview/guestview_constants.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 AdViewGuest::~AdViewGuest() { | 42 AdViewGuest::~AdViewGuest() { |
43 } | 43 } |
44 | 44 |
45 void AdViewGuest::DidCommitProvisionalLoadForFrame( | 45 void AdViewGuest::DidCommitProvisionalLoadForFrame( |
46 int64 frame_id, | 46 int64 frame_id, |
47 const base::string16& frame_unique_name, | 47 const base::string16& frame_unique_name, |
48 bool is_main_frame, | 48 bool is_main_frame, |
49 const GURL& url, | 49 const GURL& url, |
50 content::PageTransition transition_type, | 50 content::PageTransition transition_type, |
51 content::RenderViewHost* render_view_host) { | 51 content::RenderViewHost* render_view_host) { |
52 scoped_ptr<DictionaryValue> args(new DictionaryValue()); | 52 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
53 args->SetString(guestview::kUrl, url.spec()); | 53 args->SetString(guestview::kUrl, url.spec()); |
54 args->SetBoolean(guestview::kIsTopLevel, is_main_frame); | 54 args->SetBoolean(guestview::kIsTopLevel, is_main_frame); |
55 DispatchEvent(new GuestView::Event(adview::kEventLoadCommit, args.Pass())); | 55 DispatchEvent(new GuestView::Event(adview::kEventLoadCommit, args.Pass())); |
56 } | 56 } |
57 | 57 |
58 void AdViewGuest::DidFailProvisionalLoad( | 58 void AdViewGuest::DidFailProvisionalLoad( |
59 int64 frame_id, | 59 int64 frame_id, |
60 const base::string16& frame_unique_name, | 60 const base::string16& frame_unique_name, |
61 bool is_main_frame, | 61 bool is_main_frame, |
62 const GURL& validated_url, | 62 const GURL& validated_url, |
63 int error_code, | 63 int error_code, |
64 const base::string16& error_description, | 64 const base::string16& error_description, |
65 content::RenderViewHost* render_view_host) { | 65 content::RenderViewHost* render_view_host) { |
66 // Translate the |error_code| into an error string. | 66 // Translate the |error_code| into an error string. |
67 std::string error_type; | 67 std::string error_type; |
68 base::RemoveChars(net::ErrorToString(error_code), "net::", &error_type); | 68 base::RemoveChars(net::ErrorToString(error_code), "net::", &error_type); |
69 | 69 |
70 scoped_ptr<DictionaryValue> args(new DictionaryValue()); | 70 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
71 args->SetBoolean(guestview::kIsTopLevel, is_main_frame); | 71 args->SetBoolean(guestview::kIsTopLevel, is_main_frame); |
72 args->SetString(guestview::kUrl, validated_url.spec()); | 72 args->SetString(guestview::kUrl, validated_url.spec()); |
73 args->SetString(guestview::kReason, error_type); | 73 args->SetString(guestview::kReason, error_type); |
74 DispatchEvent(new GuestView::Event(adview::kEventLoadAbort, args.Pass())); | 74 DispatchEvent(new GuestView::Event(adview::kEventLoadAbort, args.Pass())); |
75 } | 75 } |
OLD | NEW |