| 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" | |
| 31 | 30 |
| 32 RenderViewHostDelegateViewHelper::RenderViewHostDelegateViewHelper() {} | 31 RenderViewHostDelegateViewHelper::RenderViewHostDelegateViewHelper() {} |
| 33 | 32 |
| 34 RenderViewHostDelegateViewHelper::~RenderViewHostDelegateViewHelper() {} | 33 RenderViewHostDelegateViewHelper::~RenderViewHostDelegateViewHelper() {} |
| 35 | 34 |
| 36 BackgroundContents* | 35 BackgroundContents* |
| 37 RenderViewHostDelegateViewHelper::MaybeCreateBackgroundContents( | 36 RenderViewHostDelegateViewHelper::MaybeCreateBackgroundContents( |
| 38 int route_id, | 37 int route_id, |
| 39 Profile* profile, | 38 Profile* profile, |
| 40 SiteInstance* site, | 39 SiteInstance* site, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 71 |
| 73 // Passed all the checks, so this should be created as a BackgroundContents. | 72 // Passed all the checks, so this should be created as a BackgroundContents. |
| 74 return profile->GetBackgroundContentsService()->CreateBackgroundContents( | 73 return profile->GetBackgroundContentsService()->CreateBackgroundContents( |
| 75 site, route_id, profile, frame_name, ASCIIToUTF16(extension->id())); | 74 site, route_id, profile, frame_name, ASCIIToUTF16(extension->id())); |
| 76 } | 75 } |
| 77 | 76 |
| 78 TabContents* RenderViewHostDelegateViewHelper::CreateNewWindow( | 77 TabContents* RenderViewHostDelegateViewHelper::CreateNewWindow( |
| 79 int route_id, | 78 int route_id, |
| 80 Profile* profile, | 79 Profile* profile, |
| 81 SiteInstance* site, | 80 SiteInstance* site, |
| 82 WebUI::TypeID webui_type, | 81 WebUITypeID webui_type, |
| 83 RenderViewHostDelegate* opener, | 82 RenderViewHostDelegate* opener, |
| 84 WindowContainerType window_container_type, | 83 WindowContainerType window_container_type, |
| 85 const string16& frame_name) { | 84 const string16& frame_name) { |
| 86 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { | 85 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { |
| 87 BackgroundContents* contents = MaybeCreateBackgroundContents( | 86 BackgroundContents* contents = MaybeCreateBackgroundContents( |
| 88 route_id, | 87 route_id, |
| 89 profile, | 88 profile, |
| 90 site, | 89 site, |
| 91 opener->GetURL(), | 90 opener->GetURL(), |
| 92 frame_name); | 91 frame_name); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 inspector_settings->SetWithoutPathExpansion(key, | 368 inspector_settings->SetWithoutPathExpansion(key, |
| 370 Value::CreateStringValue(value)); | 369 Value::CreateStringValue(value)); |
| 371 } | 370 } |
| 372 | 371 |
| 373 void RenderViewHostDelegateHelper::ClearInspectorSettings(Profile* profile) { | 372 void RenderViewHostDelegateHelper::ClearInspectorSettings(Profile* profile) { |
| 374 DictionaryValue* inspector_settings = | 373 DictionaryValue* inspector_settings = |
| 375 profile->GetPrefs()->GetMutableDictionary( | 374 profile->GetPrefs()->GetMutableDictionary( |
| 376 prefs::kWebKitInspectorSettings); | 375 prefs::kWebKitInspectorSettings); |
| 377 inspector_settings->Clear(); | 376 inspector_settings->Clear(); |
| 378 } | 377 } |
| OLD | NEW |