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

Side by Side Diff: chrome/browser/three_d_api_observer.cc

Issue 12319119: Fix layering violation in content\browser\renderer_host. That directory shouldn't be including web_… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/three_d_api_observer.h ('k') | chrome/browser/ui/browser_tab_contents.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/three_d_api_observer.h" 5 #include "chrome/browser/three_d_api_observer.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" 8 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h"
9 #include "chrome/browser/api/infobars/infobar_service.h" 9 #include "chrome/browser/api/infobars/infobar_service.h"
10 #include "chrome/browser/tab_contents/tab_util.h"
10 #include "content/public/browser/gpu_data_manager.h" 11 #include "content/public/browser/gpu_data_manager.h"
12 #include "content/public/browser/web_contents.h"
11 #include "content/public/common/three_d_api_types.h" 13 #include "content/public/common/three_d_api_types.h"
14 #include "googleurl/src/gurl.h"
12 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
13 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
14 17
15 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ThreeDAPIObserver);
16
17 namespace { 18 namespace {
18 19
19 enum ThreeDInfobarDismissalHistogram { 20 enum ThreeDInfobarDismissalHistogram {
20 THREE_D_INFOBAR_IGNORED, 21 THREE_D_INFOBAR_IGNORED,
21 THREE_D_INFOBAR_RELOADED, 22 THREE_D_INFOBAR_RELOADED,
22 THREE_D_INFOBAR_CLOSED_WITHOUT_ACTION, 23 THREE_D_INFOBAR_CLOSED_WITHOUT_ACTION,
23 THREE_D_INFOBAR_DISMISSAL_MAX 24 THREE_D_INFOBAR_DISMISSAL_MAX
24 }; 25 };
25 26
26 } // namespace 27 } // namespace
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 content::Referrer(), 156 content::Referrer(),
156 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 157 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
157 content::PAGE_TRANSITION_LINK, 158 content::PAGE_TRANSITION_LINK,
158 false)); 159 false));
159 return false; 160 return false;
160 } 161 }
161 162
162 163
163 // ThreeDAPIObserver ---------------------------------------------------- 164 // ThreeDAPIObserver ----------------------------------------------------
164 165
165 ThreeDAPIObserver::ThreeDAPIObserver(content::WebContents* web_contents) 166 ThreeDAPIObserver::ThreeDAPIObserver() {
166 : WebContentsObserver(web_contents) {} 167 content::GpuDataManager::GetInstance()->AddObserver(this);
168 }
167 169
168 ThreeDAPIObserver::~ThreeDAPIObserver() {} 170 ThreeDAPIObserver::~ThreeDAPIObserver() {
171 content::GpuDataManager::GetInstance()->RemoveObserver(this);
172 }
169 173
170 void ThreeDAPIObserver::DidBlock3DAPIs(const GURL& url, 174 void ThreeDAPIObserver::DidBlock3DAPIs(const GURL& url,
175 int render_process_id,
176 int render_view_id,
171 content::ThreeDAPIType requester) { 177 content::ThreeDAPIType requester) {
178 content::WebContents* web_contents = tab_util::GetWebContentsByID(
179 render_process_id, render_view_id);
172 ThreeDAPIInfoBarDelegate::Create( 180 ThreeDAPIInfoBarDelegate::Create(
173 InfoBarService::FromWebContents(web_contents()), url, requester); 181 InfoBarService::FromWebContents(web_contents), url, requester);
174 } 182 }
OLDNEW
« no previous file with comments | « chrome/browser/three_d_api_observer.h ('k') | chrome/browser/ui/browser_tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698