OLD | NEW |
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/renderer_host/chrome_render_message_filter.h" | 5 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 #if defined(USE_TCMALLOC) | 36 #if defined(USE_TCMALLOC) |
37 #include "chrome/browser/browser_about_handler.h" | 37 #include "chrome/browser/browser_about_handler.h" |
38 #endif | 38 #endif |
39 | 39 |
40 using content::BrowserThread; | 40 using content::BrowserThread; |
41 using extensions::APIPermission; | 41 using extensions::APIPermission; |
42 using blink::WebCache; | 42 using blink::WebCache; |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 const uint32 kFilteredMessageClasses[] = { | |
47 ChromeMsgStart, | |
48 ExtensionMsgStart, | |
49 }; | |
50 | |
51 // Logs an action to the extension activity log for the specified profile. Can | 46 // Logs an action to the extension activity log for the specified profile. Can |
52 // be called from any thread. | 47 // be called from any thread. |
53 void AddActionToExtensionActivityLog( | 48 void AddActionToExtensionActivityLog( |
54 Profile* profile, | 49 Profile* profile, |
55 scoped_refptr<extensions::Action> action) { | 50 scoped_refptr<extensions::Action> action) { |
56 #if defined(ENABLE_EXTENSIONS) | 51 #if defined(ENABLE_EXTENSIONS) |
57 // The ActivityLog can only be accessed from the main (UI) thread. If we're | 52 // The ActivityLog can only be accessed from the main (UI) thread. If we're |
58 // running on the wrong thread, re-dispatch from the main thread. | 53 // running on the wrong thread, re-dispatch from the main thread. |
59 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 54 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
60 BrowserThread::PostTask( | 55 BrowserThread::PostTask( |
(...skipping 13 matching lines...) Expand all Loading... |
74 } | 69 } |
75 #endif | 70 #endif |
76 } | 71 } |
77 | 72 |
78 } // namespace | 73 } // namespace |
79 | 74 |
80 ChromeRenderMessageFilter::ChromeRenderMessageFilter( | 75 ChromeRenderMessageFilter::ChromeRenderMessageFilter( |
81 int render_process_id, | 76 int render_process_id, |
82 Profile* profile, | 77 Profile* profile, |
83 net::URLRequestContextGetter* request_context) | 78 net::URLRequestContextGetter* request_context) |
84 : BrowserMessageFilter( | 79 : render_process_id_(render_process_id), |
85 kFilteredMessageClasses, arraysize(kFilteredMessageClasses)), | |
86 render_process_id_(render_process_id), | |
87 profile_(profile), | 80 profile_(profile), |
88 off_the_record_(profile_->IsOffTheRecord()), | 81 off_the_record_(profile_->IsOffTheRecord()), |
89 predictor_(profile_->GetNetworkPredictor()), | 82 predictor_(profile_->GetNetworkPredictor()), |
90 request_context_(request_context), | 83 request_context_(request_context), |
91 extension_info_map_( | 84 extension_info_map_( |
92 extensions::ExtensionSystem::Get(profile)->info_map()), | 85 extensions::ExtensionSystem::Get(profile)->info_map()), |
93 cookie_settings_(CookieSettings::Factory::GetForProfile(profile)), | 86 cookie_settings_(CookieSettings::Factory::GetForProfile(profile)), |
94 weak_ptr_factory_(this) { | 87 weak_ptr_factory_(this) { |
95 } | 88 } |
96 | 89 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 } | 479 } |
487 | 480 |
488 void ChromeRenderMessageFilter::OnCanTriggerClipboardWrite( | 481 void ChromeRenderMessageFilter::OnCanTriggerClipboardWrite( |
489 const GURL& origin, bool* allowed) { | 482 const GURL& origin, bool* allowed) { |
490 // Since all extensions could historically write to the clipboard, preserve it | 483 // Since all extensions could historically write to the clipboard, preserve it |
491 // for compatibility. | 484 // for compatibility. |
492 *allowed = (origin.SchemeIs(extensions::kExtensionScheme) || | 485 *allowed = (origin.SchemeIs(extensions::kExtensionScheme) || |
493 extension_info_map_->SecurityOriginHasAPIPermission( | 486 extension_info_map_->SecurityOriginHasAPIPermission( |
494 origin, render_process_id_, APIPermission::kClipboardWrite)); | 487 origin, render_process_id_, APIPermission::kClipboardWrite)); |
495 } | 488 } |
OLD | NEW |