| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/background_contents_service.h" | 12 #include "chrome/browser/background_contents_service.h" |
| 13 #include "chrome/browser/character_encoding.h" | 13 #include "chrome/browser/character_encoding.h" |
| 14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/gpu_data_manager.h" | 15 #include "chrome/browser/gpu_data_manager.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/tab_contents/background_contents.h" | 18 #include "chrome/browser/tab_contents/background_contents.h" |
| 19 #include "chrome/browser/user_style_sheet_watcher.h" | 19 #include "chrome/browser/user_style_sheet_watcher.h" |
| 20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 22 #include "content/browser/renderer_host/render_view_host.h" | 22 #include "content/browser/renderer_host/render_view_host.h" |
| 23 #include "content/browser/renderer_host/render_process_host.h" | 23 #include "content/browser/renderer_host/render_process_host.h" |
| 24 #include "content/browser/renderer_host/render_widget_fullscreen_host.h" | 24 #include "content/browser/renderer_host/render_widget_fullscreen_host.h" |
| 25 #include "content/browser/renderer_host/render_widget_host.h" | 25 #include "content/browser/renderer_host/render_widget_host.h" |
| 26 #include "content/browser/renderer_host/render_widget_host_view.h" | 26 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 27 #include "content/browser/site_instance.h" | 27 #include "content/browser/site_instance.h" |
| 28 #include "content/browser/tab_contents/tab_contents.h" | 28 #include "content/browser/tab_contents/tab_contents.h" |
| 29 #include "content/browser/tab_contents/tab_contents_view.h" | 29 #include "content/browser/tab_contents/tab_contents_view.h" |
| 30 #include "content/browser/webui/web_ui.h" |
| 30 | 31 |
| 31 RenderViewHostDelegateViewHelper::RenderViewHostDelegateViewHelper() {} | 32 RenderViewHostDelegateViewHelper::RenderViewHostDelegateViewHelper() {} |
| 32 | 33 |
| 33 RenderViewHostDelegateViewHelper::~RenderViewHostDelegateViewHelper() {} | 34 RenderViewHostDelegateViewHelper::~RenderViewHostDelegateViewHelper() {} |
| 34 | 35 |
| 35 BackgroundContents* | 36 BackgroundContents* |
| 36 RenderViewHostDelegateViewHelper::MaybeCreateBackgroundContents( | 37 RenderViewHostDelegateViewHelper::MaybeCreateBackgroundContents( |
| 37 int route_id, | 38 int route_id, |
| 38 Profile* profile, | 39 Profile* profile, |
| 39 SiteInstance* site, | 40 SiteInstance* site, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 72 |
| 72 // Passed all the checks, so this should be created as a BackgroundContents. | 73 // Passed all the checks, so this should be created as a BackgroundContents. |
| 73 return profile->GetBackgroundContentsService()->CreateBackgroundContents( | 74 return profile->GetBackgroundContentsService()->CreateBackgroundContents( |
| 74 site, route_id, profile, frame_name, ASCIIToUTF16(extension->id())); | 75 site, route_id, profile, frame_name, ASCIIToUTF16(extension->id())); |
| 75 } | 76 } |
| 76 | 77 |
| 77 TabContents* RenderViewHostDelegateViewHelper::CreateNewWindow( | 78 TabContents* RenderViewHostDelegateViewHelper::CreateNewWindow( |
| 78 int route_id, | 79 int route_id, |
| 79 Profile* profile, | 80 Profile* profile, |
| 80 SiteInstance* site, | 81 SiteInstance* site, |
| 81 WebUITypeID webui_type, | 82 WebUI::WebUITypeID webui_type, |
| 82 RenderViewHostDelegate* opener, | 83 RenderViewHostDelegate* opener, |
| 83 WindowContainerType window_container_type, | 84 WindowContainerType window_container_type, |
| 84 const string16& frame_name) { | 85 const string16& frame_name) { |
| 85 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { | 86 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { |
| 86 BackgroundContents* contents = MaybeCreateBackgroundContents( | 87 BackgroundContents* contents = MaybeCreateBackgroundContents( |
| 87 route_id, | 88 route_id, |
| 88 profile, | 89 profile, |
| 89 site, | 90 site, |
| 90 opener->GetURL(), | 91 opener->GetURL(), |
| 91 frame_name); | 92 frame_name); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 inspector_settings->SetWithoutPathExpansion(key, | 369 inspector_settings->SetWithoutPathExpansion(key, |
| 369 Value::CreateStringValue(value)); | 370 Value::CreateStringValue(value)); |
| 370 } | 371 } |
| 371 | 372 |
| 372 void RenderViewHostDelegateHelper::ClearInspectorSettings(Profile* profile) { | 373 void RenderViewHostDelegateHelper::ClearInspectorSettings(Profile* profile) { |
| 373 DictionaryValue* inspector_settings = | 374 DictionaryValue* inspector_settings = |
| 374 profile->GetPrefs()->GetMutableDictionary( | 375 profile->GetPrefs()->GetMutableDictionary( |
| 375 prefs::kWebKitInspectorSettings); | 376 prefs::kWebKitInspectorSettings); |
| 376 inspector_settings->Clear(); | 377 inspector_settings->Clear(); |
| 377 } | 378 } |
| OLD | NEW |