| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #include "chrome/browser/ui/tabs/tab_menu_model.h" | 58 #include "chrome/browser/ui/tabs/tab_menu_model.h" |
| 59 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 59 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 60 #include "chrome/browser/ui/view_ids.h" | 60 #include "chrome/browser/ui/view_ids.h" |
| 61 #include "chrome/browser/ui/views/accelerator_table.h" | 61 #include "chrome/browser/ui/views/accelerator_table.h" |
| 62 #include "chrome/browser/ui/views/accessibility/invert_bubble_view.h" | 62 #include "chrome/browser/ui/views/accessibility/invert_bubble_view.h" |
| 63 #include "chrome/browser/ui/views/autofill/save_card_bubble_views.h" | 63 #include "chrome/browser/ui/views/autofill/save_card_bubble_views.h" |
| 64 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 64 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
| 65 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" | 65 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" |
| 66 #include "chrome/browser/ui/views/browser_dialogs.h" | 66 #include "chrome/browser/ui/views/browser_dialogs.h" |
| 67 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h" | 67 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h" |
| 68 #include "chrome/browser/ui/views/download/download_shelf_view.h" | |
| 69 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" | 68 #include "chrome/browser/ui/views/exclusive_access_bubble_views.h" |
| 70 #include "chrome/browser/ui/views/extensions/bookmark_app_bubble_view.h" | 69 #include "chrome/browser/ui/views/extensions/bookmark_app_bubble_view.h" |
| 71 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views
.h" | 70 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views
.h" |
| 72 #include "chrome/browser/ui/views/frame/browser_view_layout.h" | 71 #include "chrome/browser/ui/views/frame/browser_view_layout.h" |
| 73 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" | 72 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" |
| 74 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" | 73 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" |
| 75 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 74 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 76 #include "chrome/browser/ui/views/frame/top_container_view.h" | 75 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 77 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" | 76 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" |
| 78 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 77 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 #endif | 171 #endif |
| 173 | 172 |
| 174 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 173 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 175 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h" | 174 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h" |
| 176 #include "chrome/browser/ui/sync/one_click_signin_bubble_links_delegate.h" | 175 #include "chrome/browser/ui/sync/one_click_signin_bubble_links_delegate.h" |
| 177 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" | 176 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" |
| 178 #endif | 177 #endif |
| 179 | 178 |
| 180 #if defined(OS_CHROMEOS) | 179 #if defined(OS_CHROMEOS) |
| 181 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 180 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 181 #else |
| 182 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
| 182 #endif | 183 #endif |
| 183 | 184 |
| 184 #if defined(MOJO_SHELL_CLIENT) | 185 #if defined(MOJO_SHELL_CLIENT) |
| 185 #include "content/public/common/mojo_shell_connection.h" | 186 #include "content/public/common/mojo_shell_connection.h" |
| 186 #endif | 187 #endif |
| 187 | 188 |
| 188 #if defined(OS_LINUX) | 189 #if defined(OS_LINUX) |
| 189 #include "ui/native_theme/native_theme_dark_aura.h" | 190 #include "ui/native_theme/native_theme_dark_aura.h" |
| 190 #endif | 191 #endif |
| 191 | 192 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 explicit BrowserViewLayoutDelegateImpl(BrowserView* browser_view) | 341 explicit BrowserViewLayoutDelegateImpl(BrowserView* browser_view) |
| 341 : browser_view_(browser_view) {} | 342 : browser_view_(browser_view) {} |
| 342 ~BrowserViewLayoutDelegateImpl() override {} | 343 ~BrowserViewLayoutDelegateImpl() override {} |
| 343 | 344 |
| 344 // BrowserViewLayoutDelegate overrides: | 345 // BrowserViewLayoutDelegate overrides: |
| 345 views::View* GetContentsWebView() const override { | 346 views::View* GetContentsWebView() const override { |
| 346 return browser_view_->contents_web_view_; | 347 return browser_view_->contents_web_view_; |
| 347 } | 348 } |
| 348 | 349 |
| 349 bool DownloadShelfNeedsLayout() const override { | 350 bool DownloadShelfNeedsLayout() const override { |
| 351 #if defined(OS_CHROMEOS) |
| 352 return false; |
| 353 #else |
| 350 DownloadShelfView* download_shelf = browser_view_->download_shelf_.get(); | 354 DownloadShelfView* download_shelf = browser_view_->download_shelf_.get(); |
| 351 // Re-layout the shelf either if it is visible or if its close animation | 355 // Re-layout the shelf either if it is visible or if its close animation |
| 352 // is currently running. | 356 // is currently running. |
| 353 return download_shelf && | 357 return download_shelf && |
| 354 (download_shelf->IsShowing() || download_shelf->IsClosing()); | 358 (download_shelf->IsShowing() || download_shelf->IsClosing()); |
| 359 #endif |
| 355 } | 360 } |
| 356 | 361 |
| 357 bool IsTabStripVisible() const override { | 362 bool IsTabStripVisible() const override { |
| 358 return browser_view_->IsTabStripVisible(); | 363 return browser_view_->IsTabStripVisible(); |
| 359 } | 364 } |
| 360 | 365 |
| 361 gfx::Rect GetBoundsForTabStripInBrowserView() const override { | 366 gfx::Rect GetBoundsForTabStripInBrowserView() const override { |
| 362 gfx::RectF bounds_f(browser_view_->frame()->GetBoundsForTabStrip( | 367 gfx::RectF bounds_f(browser_view_->frame()->GetBoundsForTabStrip( |
| 363 browser_view_->tabstrip())); | 368 browser_view_->tabstrip())); |
| 364 views::View::ConvertRectToTarget(browser_view_->parent(), browser_view_, | 369 views::View::ConvertRectToTarget(browser_view_->parent(), browser_view_, |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 DCHECK(download_shelf_); | 1375 DCHECK(download_shelf_); |
| 1371 browser_->UpdateDownloadShelfVisibility(visible); | 1376 browser_->UpdateDownloadShelfVisibility(visible); |
| 1372 | 1377 |
| 1373 // SetDownloadShelfVisible can force-close the shelf, so make sure we lay out | 1378 // SetDownloadShelfVisible can force-close the shelf, so make sure we lay out |
| 1374 // everything correctly, as if the animation had finished. This doesn't | 1379 // everything correctly, as if the animation had finished. This doesn't |
| 1375 // matter for showing the shelf, as the show animation will do it. | 1380 // matter for showing the shelf, as the show animation will do it. |
| 1376 ToolbarSizeChanged(false); | 1381 ToolbarSizeChanged(false); |
| 1377 } | 1382 } |
| 1378 | 1383 |
| 1379 bool BrowserView::IsDownloadShelfVisible() const { | 1384 bool BrowserView::IsDownloadShelfVisible() const { |
| 1385 #if defined(OS_CHROMEOS) |
| 1386 return false; |
| 1387 #else |
| 1380 return download_shelf_.get() && download_shelf_->IsShowing(); | 1388 return download_shelf_.get() && download_shelf_->IsShowing(); |
| 1389 #endif |
| 1381 } | 1390 } |
| 1382 | 1391 |
| 1383 DownloadShelf* BrowserView::GetDownloadShelf() { | 1392 DownloadShelf* BrowserView::GetDownloadShelf() { |
| 1384 DCHECK(browser_->SupportsWindowFeature(Browser::FEATURE_DOWNLOADSHELF)); | 1393 #if defined(OS_CHROMEOS) |
| 1394 NOTREACHED(); |
| 1395 return nullptr; |
| 1396 #else |
| 1385 if (!download_shelf_.get()) { | 1397 if (!download_shelf_.get()) { |
| 1386 download_shelf_.reset(new DownloadShelfView(browser_.get(), this)); | 1398 download_shelf_.reset(new DownloadShelfView(browser_.get(), this)); |
| 1387 download_shelf_->set_owned_by_client(); | 1399 download_shelf_->set_owned_by_client(); |
| 1388 GetBrowserViewLayout()->set_download_shelf(download_shelf_.get()); | 1400 GetBrowserViewLayout()->set_download_shelf(download_shelf_.get()); |
| 1389 } | 1401 } |
| 1390 return download_shelf_.get(); | 1402 return download_shelf_.get(); |
| 1403 #endif |
| 1391 } | 1404 } |
| 1392 | 1405 |
| 1393 void BrowserView::ConfirmBrowserCloseWithPendingDownloads( | 1406 void BrowserView::ConfirmBrowserCloseWithPendingDownloads( |
| 1394 int download_count, | 1407 int download_count, |
| 1395 Browser::DownloadClosePreventionType dialog_type, | 1408 Browser::DownloadClosePreventionType dialog_type, |
| 1396 bool app_modal, | 1409 bool app_modal, |
| 1397 const base::Callback<void(bool)>& callback) { | 1410 const base::Callback<void(bool)>& callback) { |
| 1398 DownloadInProgressDialogView::Show( | 1411 DownloadInProgressDialogView::Show( |
| 1399 GetNativeWindow(), download_count, dialog_type, app_modal, callback); | 1412 GetNativeWindow(), download_count, dialog_type, app_modal, callback); |
| 1400 } | 1413 } |
| (...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2680 // BrowserView, ExclusiveAccessContext implementation: | 2693 // BrowserView, ExclusiveAccessContext implementation: |
| 2681 Profile* BrowserView::GetProfile() { | 2694 Profile* BrowserView::GetProfile() { |
| 2682 return browser_->profile(); | 2695 return browser_->profile(); |
| 2683 } | 2696 } |
| 2684 | 2697 |
| 2685 WebContents* BrowserView::GetActiveWebContents() { | 2698 WebContents* BrowserView::GetActiveWebContents() { |
| 2686 return browser_->tab_strip_model()->GetActiveWebContents(); | 2699 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 2687 } | 2700 } |
| 2688 | 2701 |
| 2689 void BrowserView::UnhideDownloadShelf() { | 2702 void BrowserView::UnhideDownloadShelf() { |
| 2703 #if !defined(OS_CHROMEOS) |
| 2690 if (download_shelf_) | 2704 if (download_shelf_) |
| 2691 download_shelf_->Unhide(); | 2705 download_shelf_->Unhide(); |
| 2706 #endif |
| 2692 } | 2707 } |
| 2693 | 2708 |
| 2694 void BrowserView::HideDownloadShelf() { | 2709 void BrowserView::HideDownloadShelf() { |
| 2710 #if !defined(OS_CHROMEOS) |
| 2695 if (download_shelf_) | 2711 if (download_shelf_) |
| 2696 download_shelf_->Hide(); | 2712 download_shelf_->Hide(); |
| 2697 | 2713 |
| 2698 StatusBubble* status_bubble = GetStatusBubble(); | 2714 StatusBubble* status_bubble = GetStatusBubble(); |
| 2699 if (status_bubble) | 2715 if (status_bubble) |
| 2700 status_bubble->Hide(); | 2716 status_bubble->Hide(); |
| 2717 #endif |
| 2701 } | 2718 } |
| 2702 | 2719 |
| 2703 /////////////////////////////////////////////////////////////////////////////// | 2720 /////////////////////////////////////////////////////////////////////////////// |
| 2704 // BrowserView, ExclusiveAccessBubbleViewsContext implementation: | 2721 // BrowserView, ExclusiveAccessBubbleViewsContext implementation: |
| 2705 ExclusiveAccessManager* BrowserView::GetExclusiveAccessManager() { | 2722 ExclusiveAccessManager* BrowserView::GetExclusiveAccessManager() { |
| 2706 return browser_->exclusive_access_manager(); | 2723 return browser_->exclusive_access_manager(); |
| 2707 } | 2724 } |
| 2708 | 2725 |
| 2709 views::Widget* BrowserView::GetBubbleAssociatedWidget() { | 2726 views::Widget* BrowserView::GetBubbleAssociatedWidget() { |
| 2710 return GetWidget(); | 2727 return GetWidget(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2737 } | 2754 } |
| 2738 | 2755 |
| 2739 extensions::ActiveTabPermissionGranter* | 2756 extensions::ActiveTabPermissionGranter* |
| 2740 BrowserView::GetActiveTabPermissionGranter() { | 2757 BrowserView::GetActiveTabPermissionGranter() { |
| 2741 content::WebContents* web_contents = GetActiveWebContents(); | 2758 content::WebContents* web_contents = GetActiveWebContents(); |
| 2742 if (!web_contents) | 2759 if (!web_contents) |
| 2743 return nullptr; | 2760 return nullptr; |
| 2744 return extensions::TabHelper::FromWebContents(web_contents) | 2761 return extensions::TabHelper::FromWebContents(web_contents) |
| 2745 ->active_tab_permission_granter(); | 2762 ->active_tab_permission_granter(); |
| 2746 } | 2763 } |
| OLD | NEW |