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

Side by Side Diff: chrome/browser/ui/tab_contents/core_tab_helper.cc

Issue 1102173002: Move GuestView layer in browser to components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test change to build Created 5 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
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/browser/ui/tab_contents/core_tab_helper.h" 5 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/profiler/scoped_tracker.h" 12 #include "base/profiler/scoped_tracker.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/search_engines/template_url_service_factory.h" 15 #include "chrome/browser/search_engines/template_url_service_factory.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_command_controller.h" 17 #include "chrome/browser/ui/browser_command_controller.h"
18 #include "chrome/browser/ui/browser_finder.h" 18 #include "chrome/browser/ui/browser_finder.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/render_messages.h" 20 #include "chrome/common/render_messages.h"
21 #include "chrome/grit/generated_resources.h" 21 #include "chrome/grit/generated_resources.h"
22 #include "components/guest_view/browser/guest_view_manager.h"
22 #include "components/search_engines/template_url.h" 23 #include "components/search_engines/template_url.h"
23 #include "components/search_engines/template_url_service.h" 24 #include "components/search_engines/template_url_service.h"
24 #include "components/web_cache/browser/web_cache_manager.h" 25 #include "components/web_cache/browser/web_cache_manager.h"
25 #include "content/public/browser/render_process_host.h" 26 #include "content/public/browser/render_process_host.h"
26 #include "content/public/browser/render_view_host.h" 27 #include "content/public/browser/render_view_host.h"
27 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
28 #include "extensions/browser/guest_view/guest_view_manager.h"
29 #include "net/base/load_states.h" 29 #include "net/base/load_states.h"
30 #include "net/http/http_request_headers.h" 30 #include "net/http/http_request_headers.h"
31 #include "ui/base/l10n/l10n_util.h" 31 #include "ui/base/l10n/l10n_util.h"
32 32
33 using content::WebContents; 33 using content::WebContents;
34 34
35 DEFINE_WEB_CONTENTS_USER_DATA_KEY(CoreTabHelper); 35 DEFINE_WEB_CONTENTS_USER_DATA_KEY(CoreTabHelper);
36 36
37 CoreTabHelper::CoreTabHelper(WebContents* web_contents) 37 CoreTabHelper::CoreTabHelper(WebContents* web_contents)
38 : content::WebContentsObserver(web_contents), 38 : content::WebContentsObserver(web_contents),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 // static 87 // static
88 bool CoreTabHelper::GetStatusTextForWebContents( 88 bool CoreTabHelper::GetStatusTextForWebContents(
89 base::string16* status_text, content::WebContents* source) { 89 base::string16* status_text, content::WebContents* source) {
90 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/467185 is 90 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/467185 is
91 // fixed. 91 // fixed.
92 tracked_objects::ScopedTracker tracking_profile1( 92 tracked_objects::ScopedTracker tracking_profile1(
93 FROM_HERE_WITH_EXPLICIT_FUNCTION( 93 FROM_HERE_WITH_EXPLICIT_FUNCTION(
94 "467185 CoreTabHelper::GetStatusTextForWebContents1")); 94 "467185 CoreTabHelper::GetStatusTextForWebContents1"));
95 auto guest_manager = extensions::GuestViewManager::FromBrowserContext( 95 auto guest_manager = guestview::GuestViewManager::FromBrowserContext(
96 source->GetBrowserContext()); 96 source->GetBrowserContext());
97 if (!source->IsLoading() || 97 if (!source->IsLoading() ||
98 source->GetLoadState().state == net::LOAD_STATE_IDLE) { 98 source->GetLoadState().state == net::LOAD_STATE_IDLE) {
99 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/467185 99 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/467185
100 // is fixed. 100 // is fixed.
101 tracked_objects::ScopedTracker tracking_profile2( 101 tracked_objects::ScopedTracker tracking_profile2(
102 FROM_HERE_WITH_EXPLICIT_FUNCTION( 102 FROM_HERE_WITH_EXPLICIT_FUNCTION(
103 "467185 CoreTabHelper::GetStatusTextForWebContents2")); 103 "467185 CoreTabHelper::GetStatusTextForWebContents2"));
104 if (!guest_manager) 104 if (!guest_manager)
105 return false; 105 return false;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 DCHECK(!content_type.empty()); 304 DCHECK(!content_type.empty());
305 open_url_params.uses_post = true; 305 open_url_params.uses_post = true;
306 open_url_params.browser_initiated_post_data = 306 open_url_params.browser_initiated_post_data =
307 base::RefCountedString::TakeString(post_data); 307 base::RefCountedString::TakeString(post_data);
308 open_url_params.extra_headers += base::StringPrintf( 308 open_url_params.extra_headers += base::StringPrintf(
309 "%s: %s\r\n", net::HttpRequestHeaders::kContentType, 309 "%s: %s\r\n", net::HttpRequestHeaders::kContentType,
310 content_type.c_str()); 310 content_type.c_str());
311 } 311 }
312 web_contents()->OpenURL(open_url_params); 312 web_contents()->OpenURL(open_url_params);
313 } 313 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698