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

Side by Side Diff: chrome/browser/ui/views/website_settings/permission_prompt_impl_views.cc

Issue 2335623002: Use WebContents instead of Browser to construct PermissionPrompt (Closed)
Patch Set: address review comments Created 4 years, 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/memory/ptr_util.h" 5 #include "base/memory/ptr_util.h"
6 #include "chrome/browser/ui/browser.h" 6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/browser_finder.h"
7 #include "chrome/browser/ui/browser_window.h" 8 #include "chrome/browser/ui/browser_window.h"
8 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" 9 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
9 #include "chrome/browser/ui/views/frame/browser_view.h" 10 #include "chrome/browser/ui/views/frame/browser_view.h"
10 #include "chrome/browser/ui/views/frame/top_container_view.h" 11 #include "chrome/browser/ui/views/frame/top_container_view.h"
11 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 12 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
12 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" 13 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
13 #include "chrome/browser/ui/views/website_settings/permission_prompt_impl.h" 14 #include "chrome/browser/ui/views/website_settings/permission_prompt_impl.h"
15 #include "content/public/browser/web_contents.h"
14 #include "ui/gfx/geometry/point.h" 16 #include "ui/gfx/geometry/point.h"
15 #include "ui/gfx/geometry/vector2d.h" 17 #include "ui/gfx/geometry/vector2d.h"
16 18
17 // The Views browser implementation of PermissionPromptImpl's 19 // The Views browser implementation of PermissionPromptImpl's
18 // anchor methods. Views browsers have a native View to anchor the bubble to, 20 // anchor methods. Views browsers have a native View to anchor the bubble to,
19 // which these functions provide. 21 // which these functions provide.
20 22
21 // Left margin for the bubble when anchored to the top of the screen in 23 // Left margin for the bubble when anchored to the top of the screen in
22 // fullscreen mode. 24 // fullscreen mode.
23 const int kFullscreenLeftMargin = 40; 25 const int kFullscreenLeftMargin = 40;
(...skipping 17 matching lines...) Expand all
41 // not be 0,0 if there are multiple displays). 43 // not be 0,0 if there are multiple displays).
42 gfx::Point browser_view_origin = browser_view->GetBoundsInScreen().origin(); 44 gfx::Point browser_view_origin = browser_view->GetBoundsInScreen().origin();
43 return browser_view_origin + gfx::Vector2d(x_within_browser_view, 0); 45 return browser_view_origin + gfx::Vector2d(x_within_browser_view, 0);
44 } 46 }
45 47
46 views::BubbleBorder::Arrow PermissionPromptImpl::GetAnchorArrow() { 48 views::BubbleBorder::Arrow PermissionPromptImpl::GetAnchorArrow() {
47 return views::BubbleBorder::TOP_LEFT; 49 return views::BubbleBorder::TOP_LEFT;
48 } 50 }
49 51
50 // static 52 // static
51 std::unique_ptr<PermissionPrompt> PermissionPrompt::Create(Browser* browser) { 53 std::unique_ptr<PermissionPrompt> PermissionPrompt::Create(
52 return base::WrapUnique(new PermissionPromptImpl(browser)); 54 content::WebContents* web_contents) {
55 return base::WrapUnique(new PermissionPromptImpl(
56 chrome::FindBrowserWithWebContents(web_contents)));
53 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698