OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tab_contents/render_view_host_delegate_helper.h" | 5 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/background_contents_service.h" | 10 #include "chrome/browser/background_contents_service.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 BackgroundContents* | 33 BackgroundContents* |
34 RenderViewHostDelegateViewHelper::MaybeCreateBackgroundContents( | 34 RenderViewHostDelegateViewHelper::MaybeCreateBackgroundContents( |
35 int route_id, | 35 int route_id, |
36 Profile* profile, | 36 Profile* profile, |
37 SiteInstance* site, | 37 SiteInstance* site, |
38 const GURL& opener_url, | 38 const GURL& opener_url, |
39 const string16& frame_name) { | 39 const string16& frame_name) { |
40 ExtensionsService* extensions_service = profile->GetExtensionsService(); | 40 ExtensionsService* extensions_service = profile->GetExtensionsService(); |
41 | 41 |
42 if (!opener_url.is_valid() || frame_name.empty()) | 42 if (!opener_url.is_valid() || |
| 43 frame_name.empty() || |
| 44 !extensions_service || |
| 45 !extensions_service->is_ready()) |
43 return NULL; | 46 return NULL; |
44 | 47 |
45 const Extension* extension = | 48 const Extension* extension = |
46 extensions_service->GetExtensionByURL(opener_url); | 49 extensions_service->GetExtensionByURL(opener_url); |
47 if (!extension) | 50 if (!extension) |
48 extension = extensions_service->GetExtensionByWebExtent(opener_url); | 51 extension = extensions_service->GetExtensionByWebExtent(opener_url); |
49 if (!extension || | 52 if (!extension || |
50 !extension->HasApiPermission(Extension::kBackgroundPermission)) | 53 !extension->HasApiPermission(Extension::kBackgroundPermission)) |
51 return NULL; | 54 return NULL; |
52 | 55 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 inspector_settings->SetWithoutPathExpansion(key, | 327 inspector_settings->SetWithoutPathExpansion(key, |
325 Value::CreateStringValue(value)); | 328 Value::CreateStringValue(value)); |
326 } | 329 } |
327 | 330 |
328 void RenderViewHostDelegateHelper::ClearInspectorSettings(Profile* profile) { | 331 void RenderViewHostDelegateHelper::ClearInspectorSettings(Profile* profile) { |
329 DictionaryValue* inspector_settings = | 332 DictionaryValue* inspector_settings = |
330 profile->GetPrefs()->GetMutableDictionary( | 333 profile->GetPrefs()->GetMutableDictionary( |
331 prefs::kWebKitInspectorSettings); | 334 prefs::kWebKitInspectorSettings); |
332 inspector_settings->Clear(); | 335 inspector_settings->Clear(); |
333 } | 336 } |
OLD | NEW |