| 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 "extensions/browser/guest_view/web_view/web_view_guest.h" | 5 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" | 10 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 } | 782 } |
| 783 | 783 |
| 784 WebViewGuest::~WebViewGuest() { | 784 WebViewGuest::~WebViewGuest() { |
| 785 } | 785 } |
| 786 | 786 |
| 787 void WebViewGuest::DidCommitProvisionalLoadForFrame( | 787 void WebViewGuest::DidCommitProvisionalLoadForFrame( |
| 788 content::RenderFrameHost* render_frame_host, | 788 content::RenderFrameHost* render_frame_host, |
| 789 const GURL& url, | 789 const GURL& url, |
| 790 ui::PageTransition transition_type) { | 790 ui::PageTransition transition_type) { |
| 791 if (!render_frame_host->GetParent()) { | 791 if (!render_frame_host->GetParent()) { |
| 792 src_ = url; | 792 // For LoadDataWithBaseURL loads, |url| contains the data URL, but the |
| 793 // virtual URL is needed in that case. So use WebContents::GetURL instead. |
| 794 src_ = web_contents()->GetURL(); |
| 793 // Handle a pending zoom if one exists. | 795 // Handle a pending zoom if one exists. |
| 794 if (pending_zoom_factor_) { | 796 if (pending_zoom_factor_) { |
| 795 SetZoom(pending_zoom_factor_); | 797 SetZoom(pending_zoom_factor_); |
| 796 pending_zoom_factor_ = 0.0; | 798 pending_zoom_factor_ = 0.0; |
| 797 } | 799 } |
| 798 } | 800 } |
| 799 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 801 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 800 args->SetString(guest_view::kUrl, url.spec()); | 802 args->SetString(guest_view::kUrl, src_.spec()); |
| 801 args->SetBoolean(guest_view::kIsTopLevel, !render_frame_host->GetParent()); | 803 args->SetBoolean(guest_view::kIsTopLevel, !render_frame_host->GetParent()); |
| 802 args->SetString(webview::kInternalBaseURLForDataURL, | 804 args->SetString(webview::kInternalBaseURLForDataURL, |
| 803 web_contents() | 805 web_contents() |
| 804 ->GetController() | 806 ->GetController() |
| 805 .GetLastCommittedEntry() | 807 .GetLastCommittedEntry() |
| 806 ->GetBaseURLForDataURL() | 808 ->GetBaseURLForDataURL() |
| 807 .spec()); | 809 .spec()); |
| 808 args->SetInteger(webview::kInternalCurrentEntryIndex, | 810 args->SetInteger(webview::kInternalCurrentEntryIndex, |
| 809 web_contents()->GetController().GetCurrentEntryIndex()); | 811 web_contents()->GetController().GetCurrentEntryIndex()); |
| 810 args->SetInteger(webview::kInternalEntryCount, | 812 args->SetInteger(webview::kInternalEntryCount, |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 1498 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 1497 DispatchEventToView( | 1499 DispatchEventToView( |
| 1498 new GuestViewEvent(webview::kEventExitFullscreen, args.Pass())); | 1500 new GuestViewEvent(webview::kEventExitFullscreen, args.Pass())); |
| 1499 } | 1501 } |
| 1500 // Since we changed fullscreen state, sending a Resize message ensures that | 1502 // Since we changed fullscreen state, sending a Resize message ensures that |
| 1501 // renderer/ sees the change. | 1503 // renderer/ sees the change. |
| 1502 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); | 1504 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); |
| 1503 } | 1505 } |
| 1504 | 1506 |
| 1505 } // namespace extensions | 1507 } // namespace extensions |
| OLD | NEW |