Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) { | 533 BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) { |
| 534 return static_cast<BrowserView*>(browser->window()); | 534 return static_cast<BrowserView*>(browser->window()); |
| 535 } | 535 } |
| 536 | 536 |
| 537 void BrowserView::InitStatusBubble() { | 537 void BrowserView::InitStatusBubble() { |
| 538 status_bubble_.reset(new StatusBubbleViews(contents_web_view_)); | 538 status_bubble_.reset(new StatusBubbleViews(contents_web_view_)); |
| 539 contents_web_view_->SetStatusBubble(status_bubble_.get()); | 539 contents_web_view_->SetStatusBubble(status_bubble_.get()); |
| 540 } | 540 } |
| 541 | 541 |
| 542 void BrowserView::InitPermissionBubbleView() { | 542 void BrowserView::InitPermissionBubbleView() { |
| 543 std::string languages = | |
| 544 browser_->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages); | |
| 545 permission_bubble_view_.reset(new PermissionBubbleViewViews( | 543 permission_bubble_view_.reset(new PermissionBubbleViewViews( |
| 546 GetLocationBarView()->location_icon_view(), languages)); | 544 browser_->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages))); |
| 545 UpdatePermissionBubbleViewAnchor(); | |
| 546 } | |
| 547 | |
| 548 void BrowserView::UpdatePermissionBubbleViewAnchor() { | |
|
msw
2015/03/11 22:25:30
Other bubbles (bookmark, global error, avatar/prof
groby-ooo-7-16
2015/03/12 00:44:49
Hector: The OSX version manages without modificati
hcarmona
2015/03/12 18:43:33
Is there a specific person I should ping, or shoul
groby-ooo-7-16
2015/03/12 19:27:46
ainslie@ is looking at all things bubble. felt@ ca
| |
| 549 if (browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR)) { | |
| 550 permission_bubble_view_->SetAnchor( | |
| 551 GetLocationBarView()->location_icon_view(), | |
| 552 views::BubbleBorder::TOP_LEFT); | |
| 553 } else { | |
| 554 views::View* view = NULL; | |
|
msw
2015/03/11 22:25:30
nit: init |view| to |top_container_| to avoid the
hcarmona
2015/03/12 18:43:33
Done.
| |
| 555 | |
| 556 if (IsFullscreenBubbleVisible()) | |
| 557 view = exclusive_access_bubble_->GetView(); | |
| 558 else | |
| 559 view = top_container_; | |
| 560 | |
| 561 permission_bubble_view_->SetAnchor(view, views::BubbleBorder::NONE); | |
| 562 } | |
| 547 } | 563 } |
| 548 | 564 |
| 549 gfx::Rect BrowserView::GetToolbarBounds() const { | 565 gfx::Rect BrowserView::GetToolbarBounds() const { |
| 550 gfx::Rect toolbar_bounds(toolbar_->bounds()); | 566 gfx::Rect toolbar_bounds(toolbar_->bounds()); |
| 551 if (toolbar_bounds.IsEmpty()) | 567 if (toolbar_bounds.IsEmpty()) |
| 552 return toolbar_bounds; | 568 return toolbar_bounds; |
| 553 // The apparent toolbar edges are outside the "real" toolbar edges. | 569 // The apparent toolbar edges are outside the "real" toolbar edges. |
| 554 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); | 570 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); |
| 555 return toolbar_bounds; | 571 return toolbar_bounds; |
| 556 } | 572 } |
| (...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2284 } | 2300 } |
| 2285 | 2301 |
| 2286 // Undo our anti-jankiness hacks and force a re-layout. We also need to | 2302 // Undo our anti-jankiness hacks and force a re-layout. We also need to |
| 2287 // recompute the height of the infobar top arrow because toggling in and out | 2303 // recompute the height of the infobar top arrow because toggling in and out |
| 2288 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these | 2304 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these |
| 2289 // things since it computes the arrow height directly and forces a layout | 2305 // things since it computes the arrow height directly and forces a layout |
| 2290 // indirectly via UpdateUIForContents(). Reset |in_process_fullscreen_| in | 2306 // indirectly via UpdateUIForContents(). Reset |in_process_fullscreen_| in |
| 2291 // order to let the layout occur. | 2307 // order to let the layout occur. |
| 2292 in_process_fullscreen_ = false; | 2308 in_process_fullscreen_ = false; |
| 2293 ToolbarSizeChanged(false); | 2309 ToolbarSizeChanged(false); |
| 2310 | |
| 2311 UpdatePermissionBubbleViewAnchor(); | |
| 2294 } | 2312 } |
| 2295 | 2313 |
| 2296 bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const { | 2314 bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const { |
| 2297 // Kiosk mode needs the whole screen, and if we're not in an Ash desktop | 2315 // Kiosk mode needs the whole screen, and if we're not in an Ash desktop |
| 2298 // immersive fullscreen doesn't exist. | 2316 // immersive fullscreen doesn't exist. |
| 2299 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) || | 2317 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode) || |
| 2300 browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) { | 2318 browser()->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) { |
| 2301 return false; | 2319 return false; |
| 2302 } | 2320 } |
| 2303 | 2321 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2604 return immersive_mode_controller()->IsEnabled(); | 2622 return immersive_mode_controller()->IsEnabled(); |
| 2605 } | 2623 } |
| 2606 | 2624 |
| 2607 views::Widget* BrowserView::GetBubbleAssociatedWidget() { | 2625 views::Widget* BrowserView::GetBubbleAssociatedWidget() { |
| 2608 return GetWidget(); | 2626 return GetWidget(); |
| 2609 } | 2627 } |
| 2610 | 2628 |
| 2611 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { | 2629 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { |
| 2612 return top_container_->GetBoundsInScreen(); | 2630 return top_container_->GetBoundsInScreen(); |
| 2613 } | 2631 } |
| OLD | NEW |