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