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

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

Issue 13409003: Hide ContentClient getters from embedders so that they they don't reuse content's embedder API. The… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 7 years, 8 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 | Annotate | Revision Log
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/local_omnibox_popup_source.h" 5 #include "chrome/browser/search/local_omnibox_popup_source.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
11 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
12 #include "content/public/common/content_client.h"
13 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
14 #include "grit/browser_resources.h" 13 #include "grit/browser_resources.h"
15 #include "net/url_request/url_request.h" 14 #include "net/url_request/url_request.h"
15 #include "ui/base/resource/resource_bundle.h"
16 16
17 namespace { 17 namespace {
18 18
19 const char kHtmlFilename[] = "local-omnibox-popup.html"; 19 const char kHtmlFilename[] = "local-omnibox-popup.html";
20 const char kJSFilename[] = "local-omnibox-popup.js"; 20 const char kJSFilename[] = "local-omnibox-popup.js";
21 const char kCssFilename[] = "local-omnibox-popup.css"; 21 const char kCssFilename[] = "local-omnibox-popup.css";
22 const char kPageIconFilename[] = "images/page_icon.png"; 22 const char kPageIconFilename[] = "images/page_icon.png";
23 const char kPageIcon2xFilename[] = "images/2x/page_icon.png"; 23 const char kPageIcon2xFilename[] = "images/2x/page_icon.png";
24 const char kSearchIconFilename[] = "images/search_icon.png"; 24 const char kSearchIconFilename[] = "images/search_icon.png";
25 const char kSearchIcon2xFilename[] = "images/2x/search_icon.png"; 25 const char kSearchIcon2xFilename[] = "images/2x/search_icon.png";
(...skipping 28 matching lines...) Expand all
54 } else if (path == kSearchIconFilename) { 54 } else if (path == kSearchIconFilename) {
55 identifier = IDR_LOCAL_OMNIBOX_POPUP_IMAGES_SEARCH_ICON_PNG; 55 identifier = IDR_LOCAL_OMNIBOX_POPUP_IMAGES_SEARCH_ICON_PNG;
56 } else if (path == kSearchIcon2xFilename) { 56 } else if (path == kSearchIcon2xFilename) {
57 identifier = IDR_LOCAL_OMNIBOX_POPUP_IMAGES_2X_SEARCH_ICON_PNG; 57 identifier = IDR_LOCAL_OMNIBOX_POPUP_IMAGES_2X_SEARCH_ICON_PNG;
58 } else { 58 } else {
59 callback.Run(NULL); 59 callback.Run(NULL);
60 return; 60 return;
61 } 61 }
62 62
63 scoped_refptr<base::RefCountedStaticMemory> response( 63 scoped_refptr<base::RefCountedStaticMemory> response(
64 content::GetContentClient()->GetDataResourceBytes(identifier)); 64 ResourceBundle::GetSharedInstance().LoadDataResourceBytes(identifier));
65 callback.Run(response); 65 callback.Run(response);
66 } 66 }
67 67
68 std::string LocalOmniboxPopupSource::GetMimeType( 68 std::string LocalOmniboxPopupSource::GetMimeType(
69 const std::string& path) const { 69 const std::string& path) const {
70 if (path == kHtmlFilename) 70 if (path == kHtmlFilename)
71 return "text/html"; 71 return "text/html";
72 if (path == kJSFilename) 72 if (path == kJSFilename)
73 return "application/javascript"; 73 return "application/javascript";
74 if (path == kCssFilename) 74 if (path == kCssFilename)
(...skipping 18 matching lines...) Expand all
93 } 93 }
94 return false; 94 return false;
95 } 95 }
96 96
97 std::string LocalOmniboxPopupSource::GetContentSecurityPolicyFrameSrc() const { 97 std::string LocalOmniboxPopupSource::GetContentSecurityPolicyFrameSrc() const {
98 // Allow embedding of chrome search suggestion host. 98 // Allow embedding of chrome search suggestion host.
99 return base::StringPrintf("frame-src %s://%s/;", 99 return base::StringPrintf("frame-src %s://%s/;",
100 chrome::kChromeSearchScheme, 100 chrome::kChromeSearchScheme,
101 chrome::kChromeSearchSuggestionHost); 101 chrome::kChromeSearchSuggestionHost);
102 } 102 }
OLDNEW
« no previous file with comments | « chrome/browser/search/local_ntp_source.cc ('k') | chrome/browser/sync/profile_sync_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698