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

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

Issue 10412004: Revert "Revert 137734 - 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 // We have collected a set of platform-app extensions, so let's tell WebKit 408 // We have collected a set of platform-app extensions, so let's tell WebKit
408 // about them so that it can provide a default stylesheet for them. 409 // about them so that it can provide a default stylesheet for them.
409 // 410 //
410 // TODO(miket): consider enhancing WebView to allow removing 411 // TODO(miket): consider enhancing WebView to allow removing
411 // single stylesheets, or else to edit the pattern set associated 412 // single stylesheets, or else to edit the pattern set associated
412 // with one. 413 // with one.
413 WebVector<WebString> patterns; 414 WebVector<WebString> patterns;
414 patterns.assign(platform_app_patterns); 415 patterns.assign(platform_app_patterns);
415 WebView::addUserStyleSheet( 416 WebView::addUserStyleSheet(
416 WebString::fromUTF8(ResourceBundle::GetSharedInstance(). 417 WebString::fromUTF8(ResourceBundle::GetSharedInstance().
417 GetRawDataResource(IDR_PLATFORM_APP_CSS)), 418 GetRawDataResource(IDR_PLATFORM_APP_CSS,
419 ui::SCALE_FACTOR_NONE)),
418 patterns, 420 patterns,
419 WebView::UserContentInjectInAllFrames, 421 WebView::UserContentInjectInAllFrames,
420 WebView::UserStyleInjectInExistingDocuments); 422 WebView::UserStyleInjectInExistingDocuments);
421 } 423 }
422 } 424 }
423 425
424 void ExtensionDispatcher::OnUnloaded(const std::string& id) { 426 void ExtensionDispatcher::OnUnloaded(const std::string& id) {
425 extensions_.Remove(id); 427 extensions_.Remove(id);
426 // If the extension is later reloaded with a different set of permissions, 428 // If the extension is later reloaded with a different set of permissions,
427 // we'd like it to get a new isolated world ID, so that it can pick up the 429 // we'd like it to get a new isolated world ID, so that it can pick up the
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 static const char kMessage[] = 928 static const char kMessage[] =
927 "%s can only be used in an extension process."; 929 "%s can only be used in an extension process.";
928 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); 930 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str());
929 v8::ThrowException( 931 v8::ThrowException(
930 v8::Exception::Error(v8::String::New(error_msg.c_str()))); 932 v8::Exception::Error(v8::String::New(error_msg.c_str())));
931 return false; 933 return false;
932 } 934 }
933 935
934 return true; 936 return true;
935 } 937 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | chrome/renderer/extensions/json_schema_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698