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

Side by Side Diff: chrome/browser/search/iframe_source.cc

Issue 2393773002: Fix devtools unable to start a shared workers. (Closed)
Patch Set: Created 4 years, 2 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 | chrome/browser/ui/webui/app_launcher_page_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/search/iframe_source.h" 5 #include "chrome/browser/search/iframe_source.h"
6 6
7 #include "base/memory/ref_counted_memory.h" 7 #include "base/memory/ref_counted_memory.h"
8 #include "base/strings/string_piece.h" 8 #include "base/strings/string_piece.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "chrome/browser/search/instant_io_context.h" 10 #include "chrome/browser/search/instant_io_context.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 ServesPath(path); 45 ServesPath(path);
46 } 46 }
47 47
48 bool IframeSource::ShouldDenyXFrameOptions() const { 48 bool IframeSource::ShouldDenyXFrameOptions() const {
49 return false; 49 return false;
50 } 50 }
51 51
52 bool IframeSource::GetOrigin( 52 bool IframeSource::GetOrigin(
53 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, 53 const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
54 std::string* origin) const { 54 std::string* origin) const {
55 if (wc_getter.is_null())
56 return false;
55 content::WebContents* contents = wc_getter.Run(); 57 content::WebContents* contents = wc_getter.Run();
58 if (!contents)
59 return false;
56 const content::NavigationEntry* entry = 60 const content::NavigationEntry* entry =
57 contents->GetController().GetVisibleEntry(); 61 contents->GetController().GetVisibleEntry();
58 if (entry == NULL) 62 if (entry == NULL)
59 return false; 63 return false;
60 64
61 *origin = entry->GetURL().GetOrigin().spec(); 65 *origin = entry->GetURL().GetOrigin().spec();
62 // Origin should not include a trailing slash. That is part of the path. 66 // Origin should not include a trailing slash. That is part of the path.
63 base::TrimString(*origin, "/", origin); 67 base::TrimString(*origin, "/", origin);
64 return true; 68 return true;
65 } 69 }
(...skipping 15 matching lines...) Expand all
81 callback.Run(NULL); 85 callback.Run(NULL);
82 return; 86 return;
83 } 87 }
84 88
85 base::StringPiece template_js = 89 base::StringPiece template_js =
86 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); 90 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
87 std::string response(template_js.as_string()); 91 std::string response(template_js.as_string());
88 base::ReplaceFirstSubstringAfterOffset(&response, 0, "{{ORIGIN}}", origin); 92 base::ReplaceFirstSubstringAfterOffset(&response, 0, "{{ORIGIN}}", origin);
89 callback.Run(base::RefCountedString::TakeString(&response)); 93 callback.Run(base::RefCountedString::TakeString(&response));
90 } 94 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/app_launcher_page_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698