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

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: 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/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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "content/public/renderer/render_view.h" 50 #include "content/public/renderer/render_view.h"
51 #include "grit/renderer_resources.h" 51 #include "grit/renderer_resources.h"
52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" 52 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 53 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
54 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 54 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
55 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture. h" 55 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedUserGesture. h"
56 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" 56 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
58 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 58 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
59 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques t.h" 59 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques t.h"
60 #include "ui/base/layout.h"
60 #include "ui/base/resource/resource_bundle.h" 61 #include "ui/base/resource/resource_bundle.h"
61 #include "v8/include/v8.h" 62 #include "v8/include/v8.h"
62 63
63 using WebKit::WebDataSource; 64 using WebKit::WebDataSource;
64 using WebKit::WebDocument; 65 using WebKit::WebDocument;
65 using WebKit::WebFrame; 66 using WebKit::WebFrame;
66 using WebKit::WebScopedUserGesture; 67 using WebKit::WebScopedUserGesture;
67 using WebKit::WebSecurityPolicy; 68 using WebKit::WebSecurityPolicy;
68 using WebKit::WebString; 69 using WebKit::WebString;
69 using WebKit::WebVector; 70 using WebKit::WebVector;
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // We have collected a set of platform-app extensions, so let's tell WebKit 406 // We have collected a set of platform-app extensions, so let's tell WebKit
406 // about them so that it can provide a default stylesheet for them. 407 // about them so that it can provide a default stylesheet for them.
407 // 408 //
408 // TODO(miket): consider enhancing WebView to allow removing 409 // TODO(miket): consider enhancing WebView to allow removing
409 // single stylesheets, or else to edit the pattern set associated 410 // single stylesheets, or else to edit the pattern set associated
410 // with one. 411 // with one.
411 WebVector<WebString> patterns; 412 WebVector<WebString> patterns;
412 patterns.assign(platform_app_patterns); 413 patterns.assign(platform_app_patterns);
413 WebView::addUserStyleSheet( 414 WebView::addUserStyleSheet(
414 WebString::fromUTF8(ResourceBundle::GetSharedInstance(). 415 WebString::fromUTF8(ResourceBundle::GetSharedInstance().
415 GetRawDataResource(IDR_PLATFORM_APP_CSS)), 416 GetRawDataResource(IDR_PLATFORM_APP_CSS,
417 ui::SCALE_FACTOR_NONE)),
416 patterns, 418 patterns,
417 WebView::UserContentInjectInAllFrames, 419 WebView::UserContentInjectInAllFrames,
418 WebView::UserStyleInjectInExistingDocuments); 420 WebView::UserStyleInjectInExistingDocuments);
419 } 421 }
420 } 422 }
421 423
422 void ExtensionDispatcher::OnUnloaded(const std::string& id) { 424 void ExtensionDispatcher::OnUnloaded(const std::string& id) {
423 extensions_.Remove(id); 425 extensions_.Remove(id);
424 // If the extension is later reloaded with a different set of permissions, 426 // If the extension is later reloaded with a different set of permissions,
425 // we'd like it to get a new isolated world ID, so that it can pick up the 427 // we'd like it to get a new isolated world ID, so that it can pick up the
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 static const char kMessage[] = 924 static const char kMessage[] =
923 "%s can only be used in an extension process."; 925 "%s can only be used in an extension process.";
924 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); 926 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str());
925 v8::ThrowException( 927 v8::ThrowException(
926 v8::Exception::Error(v8::String::New(error_msg.c_str()))); 928 v8::Exception::Error(v8::String::New(error_msg.c_str())));
927 return false; 929 return false;
928 } 930 }
929 931
930 return true; 932 return true;
931 } 933 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698