OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/guest_view/ad_view/ad_view_guest.h" | 5 #include "chrome/browser/guest_view/ad_view/ad_view_guest.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "chrome/browser/guest_view/ad_view/ad_view_constants.h" | 8 #include "chrome/browser/guest_view/ad_view/ad_view_constants.h" |
9 #include "chrome/browser/guest_view/guest_view_constants.h" | 9 #include "chrome/browser/guest_view/guest_view_constants.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
12 | 12 |
13 using content::WebContents; | 13 using content::WebContents; |
14 | 14 |
15 AdViewGuest::AdViewGuest(int guest_instance_id, | 15 AdViewGuest::AdViewGuest(int guest_instance_id, |
16 WebContents* guest_web_contents, | 16 WebContents* guest_web_contents, |
17 const std::string& extension_id) | 17 const std::string& extension_id) |
18 : GuestView<AdViewGuest>(guest_instance_id, | 18 : GuestView<AdViewGuest>(guest_instance_id, |
19 guest_web_contents, | 19 guest_web_contents, |
20 extension_id), | 20 extension_id) { |
21 WebContentsObserver(guest_web_contents) { | |
22 } | 21 } |
23 | 22 |
24 // static | 23 // static |
25 const char AdViewGuest::Type[] = "adview"; | 24 const char AdViewGuest::Type[] = "adview"; |
26 | 25 |
27 AdViewGuest::~AdViewGuest() { | 26 AdViewGuest::~AdViewGuest() { |
28 } | 27 } |
29 | 28 |
30 void AdViewGuest::DidCommitProvisionalLoadForFrame( | 29 void AdViewGuest::DidCommitProvisionalLoadForFrame( |
31 int64 frame_id, | 30 int64 frame_id, |
(...skipping 20 matching lines...) Expand all Loading... |
52 // Translate the |error_code| into an error string. | 51 // Translate the |error_code| into an error string. |
53 std::string error_type; | 52 std::string error_type; |
54 base::RemoveChars(net::ErrorToString(error_code), "net::", &error_type); | 53 base::RemoveChars(net::ErrorToString(error_code), "net::", &error_type); |
55 | 54 |
56 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 55 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
57 args->SetBoolean(guestview::kIsTopLevel, is_main_frame); | 56 args->SetBoolean(guestview::kIsTopLevel, is_main_frame); |
58 args->SetString(guestview::kUrl, validated_url.spec()); | 57 args->SetString(guestview::kUrl, validated_url.spec()); |
59 args->SetString(guestview::kReason, error_type); | 58 args->SetString(guestview::kReason, error_type); |
60 DispatchEvent(new GuestViewBase::Event(adview::kEventLoadAbort, args.Pass())); | 59 DispatchEvent(new GuestViewBase::Event(adview::kEventLoadAbort, args.Pass())); |
61 } | 60 } |
OLD | NEW |