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

Side by Side Diff: chrome/browser/notifications/desktop_notification_service.cc

Issue 10387010: Select theme resources from ResourceBundle at requested scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. Created 8 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/notifications/desktop_notification_service.h" 5 #include "chrome/browser/notifications/desktop_notification_service.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 23 matching lines...) Expand all
34 #include "content/public/browser/render_view_host.h" 34 #include "content/public/browser/render_view_host.h"
35 #include "content/public/browser/web_contents.h" 35 #include "content/public/browser/web_contents.h"
36 #include "content/public/common/show_desktop_notification_params.h" 36 #include "content/public/common/show_desktop_notification_params.h"
37 #include "grit/browser_resources.h" 37 #include "grit/browser_resources.h"
38 #include "grit/chromium_strings.h" 38 #include "grit/chromium_strings.h"
39 #include "grit/generated_resources.h" 39 #include "grit/generated_resources.h"
40 #include "grit/theme_resources_standard.h" 40 #include "grit/theme_resources_standard.h"
41 #include "net/base/escape.h" 41 #include "net/base/escape.h"
42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
43 #include "ui/base/l10n/l10n_util.h" 43 #include "ui/base/l10n/l10n_util.h"
44 #include "ui/base/layout.h"
44 #include "ui/base/resource/resource_bundle.h" 45 #include "ui/base/resource/resource_bundle.h"
45 46
46 using content::BrowserThread; 47 using content::BrowserThread;
47 using content::RenderViewHost; 48 using content::RenderViewHost;
48 using content::WebContents; 49 using content::WebContents;
49 using WebKit::WebNotificationPresenter; 50 using WebKit::WebNotificationPresenter;
50 using WebKit::WebTextDirection; 51 using WebKit::WebTextDirection;
51 using WebKit::WebSecurityOrigin; 52 using WebKit::WebSecurityOrigin;
52 53
53 const ContentSetting kDefaultSetting = CONTENT_SETTING_ASK; 54 const ContentSetting kDefaultSetting = CONTENT_SETTING_ASK;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 "rtl" : "ltr"); 199 "rtl" : "ltr");
199 200
200 return CreateDataUrl(resource, subst); 201 return CreateDataUrl(resource, subst);
201 } 202 }
202 203
203 // static 204 // static
204 string16 DesktopNotificationService::CreateDataUrl( 205 string16 DesktopNotificationService::CreateDataUrl(
205 int resource, const std::vector<std::string>& subst) { 206 int resource, const std::vector<std::string>& subst) {
206 const base::StringPiece template_html( 207 const base::StringPiece template_html(
207 ResourceBundle::GetSharedInstance().GetRawDataResource( 208 ResourceBundle::GetSharedInstance().GetRawDataResource(
208 resource)); 209 resource, ui::SCALE_FACTOR_NONE));
209 210
210 if (template_html.empty()) { 211 if (template_html.empty()) {
211 NOTREACHED() << "unable to load template. ID: " << resource; 212 NOTREACHED() << "unable to load template. ID: " << resource;
212 return string16(); 213 return string16();
213 } 214 }
214 215
215 std::string data = ReplaceStringPlaceholders(template_html, subst, NULL); 216 std::string data = ReplaceStringPlaceholders(template_html, subst, NULL);
216 return UTF8ToUTF16("data:text/html;charset=utf-8," + 217 return UTF8ToUTF16("data:text/html;charset=utf-8," +
217 net::EscapeQueryParamValue(data, false)); 218 net::EscapeQueryParamValue(data, false));
218 } 219 }
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 450
450 if (setting == CONTENT_SETTING_ALLOW) 451 if (setting == CONTENT_SETTING_ALLOW)
451 return WebKit::WebNotificationPresenter::PermissionAllowed; 452 return WebKit::WebNotificationPresenter::PermissionAllowed;
452 if (setting == CONTENT_SETTING_BLOCK) 453 if (setting == CONTENT_SETTING_BLOCK)
453 return WebKit::WebNotificationPresenter::PermissionDenied; 454 return WebKit::WebNotificationPresenter::PermissionDenied;
454 if (setting == CONTENT_SETTING_ASK) 455 if (setting == CONTENT_SETTING_ASK)
455 return WebKit::WebNotificationPresenter::PermissionNotAllowed; 456 return WebKit::WebNotificationPresenter::PermissionNotAllowed;
456 NOTREACHED() << "Invalid notifications settings value: " << setting; 457 NOTREACHED() << "Invalid notifications settings value: " << setting;
457 return WebKit::WebNotificationPresenter::PermissionNotAllowed; 458 return WebKit::WebNotificationPresenter::PermissionNotAllowed;
458 } 459 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698