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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 877413004: Refactor away the Browser* dependency in exclusive_access (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix broken mac change Created 5 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
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/chrome_browser_ui.gypi » ('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 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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 } 939 }
940 940
941 void BrowserView::ExitFullscreen() { 941 void BrowserView::ExitFullscreen() {
942 if (!IsFullscreen()) 942 if (!IsFullscreen())
943 return; // Nothing to do. 943 return; // Nothing to do.
944 944
945 ProcessFullscreen(false, NORMAL_FULLSCREEN, GURL(), 945 ProcessFullscreen(false, NORMAL_FULLSCREEN, GURL(),
946 EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE); 946 EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE);
947 } 947 }
948 948
949 void BrowserView::UpdateFullscreenExitBubbleContent( 949 void BrowserView::UpdateExclusiveAccessExitBubbleContent(
950 const GURL& url, 950 const GURL& url,
951 ExclusiveAccessBubbleType bubble_type) { 951 ExclusiveAccessBubbleType bubble_type) {
952 // Immersive mode has no exit bubble because it has a visible strip at the 952 // Immersive mode has no exit bubble because it has a visible strip at the
953 // top that gives the user a hover target. 953 // top that gives the user a hover target.
954 // TODO(jamescook): Figure out what to do with mouse-lock. 954 // TODO(jamescook): Figure out what to do with mouse-lock.
955 if (bubble_type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE || 955 if (bubble_type == EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE ||
956 ShouldUseImmersiveFullscreenForUrl(url)) { 956 ShouldUseImmersiveFullscreenForUrl(url)) {
957 exclusive_access_bubble_.reset(); 957 exclusive_access_bubble_.reset();
958 } else if (exclusive_access_bubble_.get()) { 958 } else if (exclusive_access_bubble_.get()) {
959 exclusive_access_bubble_->UpdateContent(url, bubble_type); 959 exclusive_access_bubble_->UpdateContent(url, bubble_type);
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
2273 frame_->SetFullscreen(fullscreen); 2273 frame_->SetFullscreen(fullscreen);
2274 2274
2275 // Enable immersive before the browser refreshes its list of enabled commands. 2275 // Enable immersive before the browser refreshes its list of enabled commands.
2276 if (mode != METRO_SNAP_FULLSCREEN && ShouldUseImmersiveFullscreenForUrl(url)) 2276 if (mode != METRO_SNAP_FULLSCREEN && ShouldUseImmersiveFullscreenForUrl(url))
2277 immersive_mode_controller_->SetEnabled(fullscreen); 2277 immersive_mode_controller_->SetEnabled(fullscreen);
2278 2278
2279 browser_->WindowFullscreenStateChanged(); 2279 browser_->WindowFullscreenStateChanged();
2280 2280
2281 if (fullscreen && !chrome::IsRunningInAppMode() && 2281 if (fullscreen && !chrome::IsRunningInAppMode() &&
2282 mode != METRO_SNAP_FULLSCREEN) { 2282 mode != METRO_SNAP_FULLSCREEN) {
2283 UpdateFullscreenExitBubbleContent(url, bubble_type); 2283 UpdateExclusiveAccessExitBubbleContent(url, bubble_type);
2284 } 2284 }
2285 2285
2286 // Undo our anti-jankiness hacks and force a re-layout. We also need to 2286 // 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 2287 // recompute the height of the infobar top arrow because toggling in and out
2288 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these 2288 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these
2289 // things since it computes the arrow height directly and forces a layout 2289 // things since it computes the arrow height directly and forces a layout
2290 // indirectly via UpdateUIForContents(). Reset |in_process_fullscreen_| in 2290 // indirectly via UpdateUIForContents(). Reset |in_process_fullscreen_| in
2291 // order to let the layout occur. 2291 // order to let the layout occur.
2292 in_process_fullscreen_ = false; 2292 in_process_fullscreen_ = false;
2293 ToolbarSizeChanged(false); 2293 ToolbarSizeChanged(false);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
2495 return chrome::kNTPBookmarkBarHeight - 2495 return chrome::kNTPBookmarkBarHeight -
2496 bookmark_bar_view_->GetFullyDetachedToolbarOverlap(); 2496 bookmark_bar_view_->GetFullyDetachedToolbarOverlap();
2497 } 2497 }
2498 2498
2499 void BrowserView::ExecuteExtensionCommand( 2499 void BrowserView::ExecuteExtensionCommand(
2500 const extensions::Extension* extension, 2500 const extensions::Extension* extension,
2501 const extensions::Command& command) { 2501 const extensions::Command& command) {
2502 toolbar_->ExecuteExtensionCommand(extension, command); 2502 toolbar_->ExecuteExtensionCommand(extension, command);
2503 } 2503 }
2504 2504
2505 ExclusiveAccessContext* BrowserView::GetExclusiveAccessContext() {
2506 return this;
2507 }
2508
2505 void BrowserView::DoCutCopyPaste(void (WebContents::*method)(), 2509 void BrowserView::DoCutCopyPaste(void (WebContents::*method)(),
2506 int command_id) { 2510 int command_id) {
2507 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); 2511 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents();
2508 if (!contents) 2512 if (!contents)
2509 return; 2513 return;
2510 if (DoCutCopyPasteForWebContents(contents, method)) 2514 if (DoCutCopyPasteForWebContents(contents, method))
2511 return; 2515 return;
2512 2516
2513 WebContents* devtools = DevToolsWindow::GetInTabWebContents(contents, 2517 WebContents* devtools = DevToolsWindow::GetInTabWebContents(contents,
2514 nullptr); 2518 nullptr);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { 2565 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) {
2562 gfx::Point icon_bottom( 2566 gfx::Point icon_bottom(
2563 toolbar_->location_bar()->GetLocationBarAnchorPoint()); 2567 toolbar_->location_bar()->GetLocationBarAnchorPoint());
2564 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); 2568 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom);
2565 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr)); 2569 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(nullptr));
2566 ConvertPointToTarget(infobar_container_, this, &infobar_top); 2570 ConvertPointToTarget(infobar_container_, this, &infobar_top);
2567 top_arrow_height = infobar_top.y() - icon_bottom.y(); 2571 top_arrow_height = infobar_top.y() - icon_bottom.y();
2568 } 2572 }
2569 return top_arrow_height; 2573 return top_arrow_height;
2570 } 2574 }
2575
2576 ///////////////////////////////////////////////////////////////////////////////
2577 // BrowserView, ExclusiveAccessContext overrides
2578 Profile* BrowserView::GetProfile() {
2579 return browser_->profile();
2580 }
2581
2582 WebContents* BrowserView::GetActiveWebContents() {
2583 return browser_->tab_strip_model()->GetActiveWebContents();
2584 }
2585
2586 void BrowserView::UnhideDownloadShelf() {
2587 GetDownloadShelf()->Unhide();
2588 }
2589
2590 void BrowserView::HideDownloadShelf() {
2591 GetDownloadShelf()->Hide();
2592 StatusBubble* statusBubble = GetStatusBubble();
2593 if (statusBubble)
2594 statusBubble->Hide();
2595 }
2596
2597 ///////////////////////////////////////////////////////////////////////////////
2598 // BrowserView, ExclusiveAccessBubbleViewsContext overrides
2599 ExclusiveAccessManager* BrowserView::GetExclusiveAccessManager() {
2600 return browser_->exclusive_access_manager();
2601 }
2602
2603 bool BrowserView::IsImmersiveModeEnabled() {
2604 return immersive_mode_controller()->IsEnabled();
2605 }
2606
2607 views::Widget* BrowserView::GetBubbleAssociatedWidget() {
2608 return GetWidget();
2609 }
2610
2611 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() {
2612 return top_container_->GetBoundsInScreen();
2613 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698