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 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "chrome/browser/themes/theme_properties.h" | 45 #include "chrome/browser/themes/theme_properties.h" |
46 #include "chrome/browser/themes/theme_service.h" | 46 #include "chrome/browser/themes/theme_service.h" |
47 #include "chrome/browser/translate/chrome_translate_client.h" | 47 #include "chrome/browser/translate/chrome_translate_client.h" |
48 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" | 48 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" |
49 #include "chrome/browser/ui/browser.h" | 49 #include "chrome/browser/ui/browser.h" |
50 #include "chrome/browser/ui/browser_command_controller.h" | 50 #include "chrome/browser/ui/browser_command_controller.h" |
51 #include "chrome/browser/ui/browser_commands.h" | 51 #include "chrome/browser/ui/browser_commands.h" |
52 #include "chrome/browser/ui/browser_dialogs.h" | 52 #include "chrome/browser/ui/browser_dialogs.h" |
53 #include "chrome/browser/ui/browser_finder.h" | 53 #include "chrome/browser/ui/browser_finder.h" |
54 #include "chrome/browser/ui/browser_list.h" | 54 #include "chrome/browser/ui/browser_list.h" |
| 55 #include "chrome/browser/ui/browser_view_histogram_helper.h" |
55 #include "chrome/browser/ui/browser_window_state.h" | 56 #include "chrome/browser/ui/browser_window_state.h" |
56 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" | 57 #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" |
57 #include "chrome/browser/ui/tabs/tab_menu_model.h" | 58 #include "chrome/browser/ui/tabs/tab_menu_model.h" |
58 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 59 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
59 #include "chrome/browser/ui/view_ids.h" | 60 #include "chrome/browser/ui/view_ids.h" |
60 #include "chrome/browser/ui/views/accelerator_table.h" | 61 #include "chrome/browser/ui/views/accelerator_table.h" |
61 #include "chrome/browser/ui/views/accessibility/invert_bubble_view.h" | 62 #include "chrome/browser/ui/views/accessibility/invert_bubble_view.h" |
62 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 63 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
63 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" | 64 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" |
64 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h" | 65 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 toolbar_(nullptr), | 412 toolbar_(nullptr), |
412 find_bar_host_view_(nullptr), | 413 find_bar_host_view_(nullptr), |
413 infobar_container_(nullptr), | 414 infobar_container_(nullptr), |
414 contents_web_view_(nullptr), | 415 contents_web_view_(nullptr), |
415 devtools_web_view_(nullptr), | 416 devtools_web_view_(nullptr), |
416 contents_container_(nullptr), | 417 contents_container_(nullptr), |
417 initialized_(false), | 418 initialized_(false), |
418 handling_theme_changed_(false), | 419 handling_theme_changed_(false), |
419 in_process_fullscreen_(false), | 420 in_process_fullscreen_(false), |
420 force_location_bar_focus_(false), | 421 force_location_bar_focus_(false), |
421 activate_modal_dialog_factory_(this) { | 422 histogram_helper_(base::MakeUnique<BrowserViewHistogramHelper>()), |
422 } | 423 activate_modal_dialog_factory_(this) {} |
423 | 424 |
424 BrowserView::~BrowserView() { | 425 BrowserView::~BrowserView() { |
425 // All the tabs should have been destroyed already. If we were closed by the | 426 // All the tabs should have been destroyed already. If we were closed by the |
426 // OS with some tabs than the NativeBrowserFrame should have destroyed them. | 427 // OS with some tabs than the NativeBrowserFrame should have destroyed them. |
427 DCHECK_EQ(0, browser_->tab_strip_model()->count()); | 428 DCHECK_EQ(0, browser_->tab_strip_model()->count()); |
428 | 429 |
429 // Stop the animation timer explicitly here to avoid running it in a nested | 430 // Stop the animation timer explicitly here to avoid running it in a nested |
430 // message loop, which may run by Browser destructor. | 431 // message loop, which may run by Browser destructor. |
431 loading_animation_timer_.Stop(); | 432 loading_animation_timer_.Stop(); |
432 | 433 |
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1988 } | 1989 } |
1989 | 1990 |
1990 void BrowserView::ViewHierarchyChanged( | 1991 void BrowserView::ViewHierarchyChanged( |
1991 const ViewHierarchyChangedDetails& details) { | 1992 const ViewHierarchyChangedDetails& details) { |
1992 if (!initialized_ && details.is_add && details.child == this && GetWidget()) { | 1993 if (!initialized_ && details.is_add && details.child == this && GetWidget()) { |
1993 InitViews(); | 1994 InitViews(); |
1994 initialized_ = true; | 1995 initialized_ = true; |
1995 } | 1996 } |
1996 } | 1997 } |
1997 | 1998 |
| 1999 void BrowserView::PaintChildren(const ui::PaintContext& context) { |
| 2000 views::ClientView::PaintChildren(context); |
| 2001 histogram_helper_->OnDidPaintChildren(GetWidget()->GetCompositor()); |
| 2002 } |
| 2003 |
1998 void BrowserView::ChildPreferredSizeChanged(View* child) { | 2004 void BrowserView::ChildPreferredSizeChanged(View* child) { |
1999 Layout(); | 2005 Layout(); |
2000 } | 2006 } |
2001 | 2007 |
2002 void BrowserView::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 2008 void BrowserView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
2003 node_data->role = ui::AX_ROLE_CLIENT; | 2009 node_data->role = ui::AX_ROLE_CLIENT; |
2004 } | 2010 } |
2005 | 2011 |
2006 void BrowserView::OnThemeChanged() { | 2012 void BrowserView::OnThemeChanged() { |
2007 if (!IsRegularOrGuestSession()) { | 2013 if (!IsRegularOrGuestSession()) { |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2684 } | 2690 } |
2685 | 2691 |
2686 extensions::ActiveTabPermissionGranter* | 2692 extensions::ActiveTabPermissionGranter* |
2687 BrowserView::GetActiveTabPermissionGranter() { | 2693 BrowserView::GetActiveTabPermissionGranter() { |
2688 content::WebContents* web_contents = GetActiveWebContents(); | 2694 content::WebContents* web_contents = GetActiveWebContents(); |
2689 if (!web_contents) | 2695 if (!web_contents) |
2690 return nullptr; | 2696 return nullptr; |
2691 return extensions::TabHelper::FromWebContents(web_contents) | 2697 return extensions::TabHelper::FromWebContents(web_contents) |
2692 ->active_tab_permission_granter(); | 2698 ->active_tab_permission_granter(); |
2693 } | 2699 } |
OLD | NEW |