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

Side by Side Diff: chrome/renderer/extensions/extension_dispatcher.cc

Issue 10387010: Select theme resources from ResourceBundle at requested scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Convert ptr to bool for win compile. 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/renderer/extensions/extension_dispatcher.h" 5 #include "chrome/renderer/extensions/extension_dispatcher.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "grit/renderer_resources.h" 49 #include "grit/renderer_resources.h"
50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" 50 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 51 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture. h" 53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture. h"
54 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" 54 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
55 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 55 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
56 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 56 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
57 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques t.h" 57 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques t.h"
58 #include "ui/base/resource/resource_bundle.h" 58 #include "ui/base/resource/resource_bundle.h"
59 #include "ui/base/resource/resource_handle.h"
59 #include "v8/include/v8.h" 60 #include "v8/include/v8.h"
60 61
61 using WebKit::WebDataSource; 62 using WebKit::WebDataSource;
62 using WebKit::WebDocument; 63 using WebKit::WebDocument;
63 using WebKit::WebFrame; 64 using WebKit::WebFrame;
64 using WebKit::WebScopedUserGesture; 65 using WebKit::WebScopedUserGesture;
65 using WebKit::WebSecurityPolicy; 66 using WebKit::WebSecurityPolicy;
66 using WebKit::WebString; 67 using WebKit::WebString;
67 using WebKit::WebVector; 68 using WebKit::WebVector;
68 using WebKit::WebView; 69 using WebKit::WebView;
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 // We have collected a set of platform-app extensions, so let's tell WebKit 382 // We have collected a set of platform-app extensions, so let's tell WebKit
382 // about them so that it can provide a default stylesheet for them. 383 // about them so that it can provide a default stylesheet for them.
383 // 384 //
384 // TODO(miket): consider enhancing WebView to allow removing 385 // TODO(miket): consider enhancing WebView to allow removing
385 // single stylesheets, or else to edit the pattern set associated 386 // single stylesheets, or else to edit the pattern set associated
386 // with one. 387 // with one.
387 WebVector<WebString> patterns; 388 WebVector<WebString> patterns;
388 patterns.assign(platform_app_patterns); 389 patterns.assign(platform_app_patterns);
389 WebView::addUserStyleSheet( 390 WebView::addUserStyleSheet(
390 WebString::fromUTF8(ResourceBundle::GetSharedInstance(). 391 WebString::fromUTF8(ResourceBundle::GetSharedInstance().
391 GetRawDataResource(IDR_PLATFORM_APP_CSS)), 392 GetRawDataResource(IDR_PLATFORM_APP_CSS,
393 ui::ResourceHandle::kScaleFactorNone)),
392 patterns, 394 patterns,
393 WebView::UserContentInjectInAllFrames, 395 WebView::UserContentInjectInAllFrames,
394 WebView::UserStyleInjectInExistingDocuments); 396 WebView::UserStyleInjectInExistingDocuments);
395 } 397 }
396 } 398 }
397 399
398 void ExtensionDispatcher::OnUnloaded(const std::string& id) { 400 void ExtensionDispatcher::OnUnloaded(const std::string& id) {
399 extensions_.Remove(id); 401 extensions_.Remove(id);
400 // If the extension is later reloaded with a different set of permissions, 402 // If the extension is later reloaded with a different set of permissions,
401 // we'd like it to get a new isolated world ID, so that it can pick up the 403 // we'd like it to get a new isolated world ID, so that it can pick up the
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 static const char kMessage[] = 895 static const char kMessage[] =
894 "%s can only be used in an extension process."; 896 "%s can only be used in an extension process.";
895 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); 897 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str());
896 v8::ThrowException( 898 v8::ThrowException(
897 v8::Exception::Error(v8::String::New(error_msg.c_str()))); 899 v8::Exception::Error(v8::String::New(error_msg.c_str())));
898 return false; 900 return false;
899 } 901 }
900 902
901 return true; 903 return true;
902 } 904 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698