| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 return false; | 719 return false; |
| 720 | 720 |
| 721 controller.GoToOffset(relative_index); | 721 controller.GoToOffset(relative_index); |
| 722 return true; | 722 return true; |
| 723 } | 723 } |
| 724 | 724 |
| 725 void WebViewGuest::Reload() { | 725 void WebViewGuest::Reload() { |
| 726 // TODO(fsamuel): Don't check for repost because we don't want to show | 726 // TODO(fsamuel): Don't check for repost because we don't want to show |
| 727 // Chromium's repost warning. We might want to implement a separate API | 727 // Chromium's repost warning. We might want to implement a separate API |
| 728 // for registering a callback if a repost is about to happen. | 728 // for registering a callback if a repost is about to happen. |
| 729 web_contents()->GetController().Reload(false); | 729 web_contents()->GetController().Reload(content::ReloadType::NORMAL, false); |
| 730 } | 730 } |
| 731 | 731 |
| 732 void WebViewGuest::SetUserAgentOverride( | 732 void WebViewGuest::SetUserAgentOverride( |
| 733 const std::string& user_agent_override) { | 733 const std::string& user_agent_override) { |
| 734 is_overriding_user_agent_ = !user_agent_override.empty(); | 734 is_overriding_user_agent_ = !user_agent_override.empty(); |
| 735 if (is_overriding_user_agent_) { | 735 if (is_overriding_user_agent_) { |
| 736 content::RecordAction(UserMetricsAction("WebView.Guest.OverrideUA")); | 736 content::RecordAction(UserMetricsAction("WebView.Guest.OverrideUA")); |
| 737 } | 737 } |
| 738 web_contents()->SetUserAgentOverride(user_agent_override); | 738 web_contents()->SetUserAgentOverride(user_agent_override); |
| 739 } | 739 } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 DispatchEventToView( | 880 DispatchEventToView( |
| 881 base::MakeUnique<GuestViewEvent>(webview::kEventExit, std::move(args))); | 881 base::MakeUnique<GuestViewEvent>(webview::kEventExit, std::move(args))); |
| 882 } | 882 } |
| 883 | 883 |
| 884 void WebViewGuest::UserAgentOverrideSet(const std::string& user_agent) { | 884 void WebViewGuest::UserAgentOverrideSet(const std::string& user_agent) { |
| 885 content::NavigationController& controller = web_contents()->GetController(); | 885 content::NavigationController& controller = web_contents()->GetController(); |
| 886 content::NavigationEntry* entry = controller.GetVisibleEntry(); | 886 content::NavigationEntry* entry = controller.GetVisibleEntry(); |
| 887 if (!entry) | 887 if (!entry) |
| 888 return; | 888 return; |
| 889 entry->SetIsOverridingUserAgent(!user_agent.empty()); | 889 entry->SetIsOverridingUserAgent(!user_agent.empty()); |
| 890 web_contents()->GetController().Reload(false); | 890 web_contents()->GetController().Reload(content::ReloadType::NORMAL, false); |
| 891 } | 891 } |
| 892 | 892 |
| 893 void WebViewGuest::FrameNameChanged(RenderFrameHost* render_frame_host, | 893 void WebViewGuest::FrameNameChanged(RenderFrameHost* render_frame_host, |
| 894 const std::string& name) { | 894 const std::string& name) { |
| 895 if (render_frame_host->GetParent()) | 895 if (render_frame_host->GetParent()) |
| 896 return; | 896 return; |
| 897 | 897 |
| 898 if (name_ == name) | 898 if (name_ == name) |
| 899 return; | 899 return; |
| 900 | 900 |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1516 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 1516 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 1517 DispatchEventToView(base::MakeUnique<GuestViewEvent>( | 1517 DispatchEventToView(base::MakeUnique<GuestViewEvent>( |
| 1518 webview::kEventExitFullscreen, std::move(args))); | 1518 webview::kEventExitFullscreen, std::move(args))); |
| 1519 } | 1519 } |
| 1520 // Since we changed fullscreen state, sending a Resize message ensures that | 1520 // Since we changed fullscreen state, sending a Resize message ensures that |
| 1521 // renderer/ sees the change. | 1521 // renderer/ sees the change. |
| 1522 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); | 1522 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); |
| 1523 } | 1523 } |
| 1524 | 1524 |
| 1525 } // namespace extensions | 1525 } // namespace extensions |
| OLD | NEW |