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

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

Issue 2485253002: Remove unnecessary calls to GURL() (Closed)
Patch Set: Assert that StringPiece must always be canonicalized. Fix some constants. Created 4 years, 1 month 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
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 <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "components/crx_file/id_util.h" 10 #include "components/crx_file/id_util.h"
(...skipping 29 matching lines...) Expand all
40 GuestViewBase* ExtensionViewGuest::Create(WebContents* owner_web_contents) { 40 GuestViewBase* ExtensionViewGuest::Create(WebContents* owner_web_contents) {
41 return new ExtensionViewGuest(owner_web_contents); 41 return new ExtensionViewGuest(owner_web_contents);
42 } 42 }
43 43
44 bool ExtensionViewGuest::NavigateGuest(const std::string& src, 44 bool ExtensionViewGuest::NavigateGuest(const std::string& src,
45 bool force_navigation) { 45 bool force_navigation) {
46 GURL url = extension_url_.Resolve(src); 46 GURL url = extension_url_.Resolve(src);
47 47
48 // If the URL is not valid, about:blank, or the same origin as the extension, 48 // If the URL is not valid, about:blank, or the same origin as the extension,
49 // then navigate to about:blank. 49 // then navigate to about:blank.
50 bool url_not_allowed = url != GURL(url::kAboutBlankURL) && 50 bool url_not_allowed =
51 !url::IsSameOriginWith(url, extension_url_); 51 url != url::kAboutBlankURL && !url::IsSameOriginWith(url, extension_url_);
52 if (!url.is_valid() || url_not_allowed) 52 if (!url.is_valid() || url_not_allowed)
53 return NavigateGuest(url::kAboutBlankURL, true /* force_navigation */); 53 return NavigateGuest(url::kAboutBlankURL, true /* force_navigation */);
54 54
55 if (!force_navigation && (url_ == url)) 55 if (!force_navigation && (url_ == url))
56 return false; 56 return false;
57 57
58 web_contents()->GetRenderProcessHost()->FilterURL(false, &url); 58 web_contents()->GetRenderProcessHost()->FilterURL(false, &url);
59 web_contents()->GetController().LoadURL(url, content::Referrer(), 59 web_contents()->GetController().LoadURL(url, content::Referrer(),
60 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, 60 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
61 std::string()); 61 std::string());
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 } 142 }
143 143
144 void ExtensionViewGuest::ApplyAttributes(const base::DictionaryValue& params) { 144 void ExtensionViewGuest::ApplyAttributes(const base::DictionaryValue& params) {
145 std::string src; 145 std::string src;
146 params.GetString(extensionview::kAttributeSrc, &src); 146 params.GetString(extensionview::kAttributeSrc, &src);
147 NavigateGuest(src, false /* force_navigation */); 147 NavigateGuest(src, false /* force_navigation */);
148 } 148 }
149 149
150 } // namespace extensions 150 } // namespace extensions
OLDNEW
« no previous file with comments | « content/test/data/dom_storage/webcore_test_database.localstorage ('k') | ios/chrome/browser/browser_about_rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698