Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: extensions/browser/guest_view/extension_view/extension_view_guest.cc

Issue 936223002: <extensionview>: Set src as relative URL on loadcommit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/extension_view/extension_view_guest.h" 5 #include "extensions/browser/guest_view/extension_view/extension_view_guest.h"
6 6
7 #include "base/metrics/user_metrics.h" 7 #include "base/metrics/user_metrics.h"
8 #include "components/crx_file/id_util.h" 8 #include "components/crx_file/id_util.h"
9 #include "content/public/browser/render_process_host.h" 9 #include "content/public/browser/render_process_host.h"
10 #include "content/public/common/result_codes.h" 10 #include "content/public/common/result_codes.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 int ExtensionViewGuest::GetTaskPrefix() const { 120 int ExtensionViewGuest::GetTaskPrefix() const {
121 return IDS_EXTENSION_TASK_MANAGER_EXTENSIONVIEW_TAG_PREFIX; 121 return IDS_EXTENSION_TASK_MANAGER_EXTENSIONVIEW_TAG_PREFIX;
122 } 122 }
123 123
124 // content::WebContentsObserver implementation. 124 // content::WebContentsObserver implementation.
125 void ExtensionViewGuest::DidCommitProvisionalLoadForFrame( 125 void ExtensionViewGuest::DidCommitProvisionalLoadForFrame(
126 content::RenderFrameHost* render_frame_host, 126 content::RenderFrameHost* render_frame_host,
127 const GURL& url, 127 const GURL& url,
128 ui::PageTransition transition_type) { 128 ui::PageTransition transition_type) {
129 if (!render_frame_host->GetParent()) 129 if (!render_frame_host->GetParent())
Fady Samuel 2015/02/18 21:50:25 Since you're only using this event to update the s
apacible 2015/02/18 22:02:56 Done.
130 view_page_ = url; 130 view_page_ = url;
131 131
132 // Gets chrome-extension://extensionid/ prefix.
133 std::string prefix = url.GetWithEmptyPath().spec();
134 std::string relative_url = url.spec();
135
136 // Removes the prefix.
137 ReplaceFirstSubstringAfterOffset(&relative_url, 0, prefix, "");
Fady Samuel 2015/02/18 21:50:25 Add the include for the header at the top.
apacible 2015/02/18 22:02:56 Done.
138
132 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 139 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
133 args->SetString(guestview::kUrl, url.spec()); 140 args->SetString(guestview::kUrl, relative_url);
134 DispatchEventToView( 141 DispatchEventToView(
135 new GuestViewBase::Event(extensionview::kEventLoadCommit, args.Pass())); 142 new GuestViewBase::Event(extensionview::kEventLoadCommit, args.Pass()));
136 } 143 }
137 144
138 void ExtensionViewGuest::DidNavigateMainFrame( 145 void ExtensionViewGuest::DidNavigateMainFrame(
139 const content::LoadCommittedDetails& details, 146 const content::LoadCommittedDetails& details,
140 const content::FrameNavigateParams& params) { 147 const content::FrameNavigateParams& params) {
141 if (attached() && (params.url.GetOrigin() != view_page_.GetOrigin())) { 148 if (attached() && (params.url.GetOrigin() != view_page_.GetOrigin())) {
142 base::RecordAction(base::UserMetricsAction("BadMessageTerminate_EVG")); 149 base::RecordAction(base::UserMetricsAction("BadMessageTerminate_EVG"));
143 web_contents()->GetRenderProcessHost()->Shutdown( 150 web_contents()->GetRenderProcessHost()->Shutdown(
(...skipping 17 matching lines...) Expand all
161 web_contents()->GetRenderViewHost()); 168 web_contents()->GetRenderViewHost());
162 } 169 }
163 170
164 void ExtensionViewGuest::ApplyAttributes(const base::DictionaryValue& params) { 171 void ExtensionViewGuest::ApplyAttributes(const base::DictionaryValue& params) {
165 std::string src; 172 std::string src;
166 params.GetString(extensionview::kAttributeSrc, &src); 173 params.GetString(extensionview::kAttributeSrc, &src);
167 NavigateGuest(src, false /* force_navigation */); 174 NavigateGuest(src, false /* force_navigation */);
168 } 175 }
169 176
170 } // namespace extensions 177 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698