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

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

Issue 1686903002: [Abandoned] Rename PermissionBubbleManager to PermissionRequestManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests compile Created 4 years, 8 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 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 13 matching lines...) Expand all
24 #include "chrome/app/chrome_command_ids.h" 24 #include "chrome/app/chrome_command_ids.h"
25 #include "chrome/app/chrome_dll_resource.h" 25 #include "chrome/app/chrome_dll_resource.h"
26 #include "chrome/browser/app_mode/app_mode_utils.h" 26 #include "chrome/browser/app_mode/app_mode_utils.h"
27 #include "chrome/browser/bookmarks/bookmark_stats.h" 27 #include "chrome/browser/bookmarks/bookmark_stats.h"
28 #include "chrome/browser/browser_process.h" 28 #include "chrome/browser/browser_process.h"
29 #include "chrome/browser/chrome_notification_types.h" 29 #include "chrome/browser/chrome_notification_types.h"
30 #include "chrome/browser/extensions/extension_util.h" 30 #include "chrome/browser/extensions/extension_util.h"
31 #include "chrome/browser/extensions/tab_helper.h" 31 #include "chrome/browser/extensions/tab_helper.h"
32 #include "chrome/browser/infobars/infobar_service.h" 32 #include "chrome/browser/infobars/infobar_service.h"
33 #include "chrome/browser/native_window_notification_source.h" 33 #include "chrome/browser/native_window_notification_source.h"
34 #include "chrome/browser/permissions/permission_request_manager.h"
34 #include "chrome/browser/profiles/avatar_menu.h" 35 #include "chrome/browser/profiles/avatar_menu.h"
35 #include "chrome/browser/profiles/profile.h" 36 #include "chrome/browser/profiles/profile.h"
36 #include "chrome/browser/profiles/profile_attributes_entry.h" 37 #include "chrome/browser/profiles/profile_attributes_entry.h"
37 #include "chrome/browser/profiles/profile_attributes_storage.h" 38 #include "chrome/browser/profiles/profile_attributes_storage.h"
38 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 39 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
39 #include "chrome/browser/profiles/profile_manager.h" 40 #include "chrome/browser/profiles/profile_manager.h"
40 #include "chrome/browser/profiles/profile_window.h" 41 #include "chrome/browser/profiles/profile_window.h"
41 #include "chrome/browser/profiles/profiles_state.h" 42 #include "chrome/browser/profiles/profiles_state.h"
42 #include "chrome/browser/search/search.h" 43 #include "chrome/browser/search/search.h"
43 #include "chrome/browser/sessions/tab_restore_service_factory.h" 44 #include "chrome/browser/sessions/tab_restore_service_factory.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 #include "chrome/browser/ui/views/tabs/tab.h" 94 #include "chrome/browser/ui/views/tabs/tab.h"
94 #include "chrome/browser/ui/views/tabs/tab_strip.h" 95 #include "chrome/browser/ui/views/tabs/tab_strip.h"
95 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" 96 #include "chrome/browser/ui/views/toolbar/app_menu_button.h"
96 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" 97 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
97 #include "chrome/browser/ui/views/toolbar/reload_button.h" 98 #include "chrome/browser/ui/views/toolbar/reload_button.h"
98 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 99 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
99 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" 100 #include "chrome/browser/ui/views/translate/translate_bubble_view.h"
100 #include "chrome/browser/ui/views/update_recommended_message_box.h" 101 #include "chrome/browser/ui/views/update_recommended_message_box.h"
101 #include "chrome/browser/ui/views/website_settings/permissions_bubble_view.h" 102 #include "chrome/browser/ui/views/website_settings/permissions_bubble_view.h"
102 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " 103 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h "
103 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
104 #include "chrome/browser/ui/window_sizer/window_sizer.h" 104 #include "chrome/browser/ui/window_sizer/window_sizer.h"
105 #include "chrome/common/chrome_switches.h" 105 #include "chrome/common/chrome_switches.h"
106 #include "chrome/common/extensions/command.h" 106 #include "chrome/common/extensions/command.h"
107 #include "chrome/common/features.h" 107 #include "chrome/common/features.h"
108 #include "chrome/common/pref_names.h" 108 #include "chrome/common/pref_names.h"
109 #include "chrome/common/url_constants.h" 109 #include "chrome/common/url_constants.h"
110 #include "chrome/grit/chromium_strings.h" 110 #include "chrome/grit/chromium_strings.h"
111 #include "chrome/grit/generated_resources.h" 111 #include "chrome/grit/generated_resources.h"
112 #include "chrome/grit/locale_settings.h" 112 #include "chrome/grit/locale_settings.h"
113 #include "components/app_modal/app_modal_dialog.h" 113 #include "components/app_modal/app_modal_dialog.h"
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 // callback to us and trigger layout. 864 // callback to us and trigger layout.
865 if (bookmark_bar_view_.get()) { 865 if (bookmark_bar_view_.get()) {
866 bookmark_bar_view_->SetBookmarkBarState( 866 bookmark_bar_view_->SetBookmarkBarState(
867 browser_->bookmark_bar_state(), 867 browser_->bookmark_bar_state(),
868 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); 868 BookmarkBar::DONT_ANIMATE_STATE_CHANGE);
869 } 869 }
870 870
871 infobar_container_->ChangeInfoBarManager( 871 infobar_container_->ChangeInfoBarManager(
872 InfoBarService::FromWebContents(new_contents)); 872 InfoBarService::FromWebContents(new_contents));
873 873
874 if (old_contents && PermissionBubbleManager::FromWebContents(old_contents)) 874 if (old_contents && PermissionRequestManager::FromWebContents(old_contents))
875 PermissionBubbleManager::FromWebContents(old_contents)->HideBubble(); 875 PermissionRequestManager::FromWebContents(old_contents)->HideBubble();
876 876
877 if (new_contents && PermissionBubbleManager::FromWebContents(new_contents)) { 877 if (new_contents && PermissionRequestManager::FromWebContents(new_contents)) {
878 PermissionBubbleManager::FromWebContents(new_contents) 878 PermissionRequestManager::FromWebContents(new_contents)
879 ->DisplayPendingRequests(); 879 ->DisplayPendingRequests();
880 } 880 }
881 881
882 UpdateUIForContents(new_contents); 882 UpdateUIForContents(new_contents);
883 883
884 // Layout for DevTools _before_ setting the both main and devtools WebContents 884 // Layout for DevTools _before_ setting the both main and devtools WebContents
885 // to avoid toggling the size of any of them. 885 // to avoid toggling the size of any of them.
886 UpdateDevToolsForContents(new_contents, !change_tab_contents); 886 UpdateDevToolsForContents(new_contents, !change_tab_contents);
887 887
888 if (change_tab_contents) { 888 if (change_tab_contents) {
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 DCHECK(contents->GetNativeView()->GetRootWindow()); 1550 DCHECK(contents->GetNativeView()->GetRootWindow());
1551 } 1551 }
1552 #endif 1552 #endif
1553 web_contents_close_handler_->TabInserted(); 1553 web_contents_close_handler_->TabInserted();
1554 1554
1555 if (foreground) 1555 if (foreground)
1556 extensions::MaybeShowExtensionControlledNewTabPage(browser(), contents); 1556 extensions::MaybeShowExtensionControlledNewTabPage(browser(), contents);
1557 } 1557 }
1558 1558
1559 void BrowserView::TabDetachedAt(WebContents* contents, int index) { 1559 void BrowserView::TabDetachedAt(WebContents* contents, int index) {
1560 if (PermissionBubbleManager::FromWebContents(contents)) 1560 if (PermissionRequestManager::FromWebContents(contents))
1561 PermissionBubbleManager::FromWebContents(contents)->HideBubble(); 1561 PermissionRequestManager::FromWebContents(contents)->HideBubble();
1562 1562
1563 // We use index here rather than comparing |contents| because by this time 1563 // We use index here rather than comparing |contents| because by this time
1564 // the model has already removed |contents| from its list, so 1564 // the model has already removed |contents| from its list, so
1565 // browser_->GetActiveWebContents() will return null or something else. 1565 // browser_->GetActiveWebContents() will return null or something else.
1566 if (index == browser_->tab_strip_model()->active_index()) { 1566 if (index == browser_->tab_strip_model()->active_index()) {
1567 // We need to reset the current tab contents to null before it gets 1567 // We need to reset the current tab contents to null before it gets
1568 // freed. This is because the focus manager performs some operations 1568 // freed. This is because the focus manager performs some operations
1569 // on the selected WebContents when it is removed. 1569 // on the selected WebContents when it is removed.
1570 web_contents_close_handler_->ActiveTabChanged(); 1570 web_contents_close_handler_->ActiveTabChanged();
1571 contents_web_view_->SetWebContents(nullptr); 1571 contents_web_view_->SetWebContents(nullptr);
1572 infobar_container_->ChangeInfoBarManager(nullptr); 1572 infobar_container_->ChangeInfoBarManager(nullptr);
1573 UpdateDevToolsForContents(nullptr, true); 1573 UpdateDevToolsForContents(nullptr, true);
1574 } 1574 }
1575 } 1575 }
1576 1576
1577 void BrowserView::TabDeactivated(WebContents* contents) { 1577 void BrowserView::TabDeactivated(WebContents* contents) {
1578 if (PermissionBubbleManager::FromWebContents(contents)) 1578 if (PermissionRequestManager::FromWebContents(contents))
1579 PermissionBubbleManager::FromWebContents(contents)->HideBubble(); 1579 PermissionRequestManager::FromWebContents(contents)->HideBubble();
1580 1580
1581 // We do not store the focus when closing the tab to work-around bug 4633. 1581 // We do not store the focus when closing the tab to work-around bug 4633.
1582 // Some reports seem to show that the focus manager and/or focused view can 1582 // Some reports seem to show that the focus manager and/or focused view can
1583 // be garbage at that point, it is not clear why. 1583 // be garbage at that point, it is not clear why.
1584 if (!contents->IsBeingDestroyed()) 1584 if (!contents->IsBeingDestroyed())
1585 contents->StoreFocus(); 1585 contents->StoreFocus();
1586 } 1586 }
1587 1587
1588 void BrowserView::TabStripEmpty() { 1588 void BrowserView::TabStripEmpty() {
1589 // Make sure all optional UI is removed before we are destroyed, otherwise 1589 // Make sure all optional UI is removed before we are destroyed, otherwise
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 // Undo our anti-jankiness hacks and force a re-layout. We also need to 2336 // Undo our anti-jankiness hacks and force a re-layout. We also need to
2337 // recompute the height of the infobar top arrow because toggling in and out 2337 // recompute the height of the infobar top arrow because toggling in and out
2338 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these 2338 // of fullscreen changes it. Calling ToolbarSizeChanged() will do both these
2339 // things since it computes the arrow height directly and forces a layout 2339 // things since it computes the arrow height directly and forces a layout
2340 // indirectly via UpdateUIForContents(). Reset |in_process_fullscreen_| in 2340 // indirectly via UpdateUIForContents(). Reset |in_process_fullscreen_| in
2341 // order to let the layout occur. 2341 // order to let the layout occur.
2342 in_process_fullscreen_ = false; 2342 in_process_fullscreen_ = false;
2343 ToolbarSizeChanged(false); 2343 ToolbarSizeChanged(false);
2344 2344
2345 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); 2345 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents();
2346 if (contents && PermissionBubbleManager::FromWebContents(contents)) 2346 if (contents && PermissionRequestManager::FromWebContents(contents))
2347 PermissionBubbleManager::FromWebContents(contents)->UpdateAnchorPosition(); 2347 PermissionRequestManager::FromWebContents(contents)->UpdateAnchorPosition();
2348 } 2348 }
2349 2349
2350 bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const { 2350 bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {
2351 #if defined(USE_ASH) 2351 #if defined(USE_ASH)
2352 // Kiosk mode needs the whole screen. 2352 // Kiosk mode needs the whole screen.
2353 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode)) 2353 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode))
2354 return false; 2354 return false;
2355 2355
2356 return url.is_empty(); 2356 return url.is_empty();
2357 #else 2357 #else
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2646 } 2646 }
2647 2647
2648 extensions::ActiveTabPermissionGranter* 2648 extensions::ActiveTabPermissionGranter*
2649 BrowserView::GetActiveTabPermissionGranter() { 2649 BrowserView::GetActiveTabPermissionGranter() {
2650 content::WebContents* web_contents = GetActiveWebContents(); 2650 content::WebContents* web_contents = GetActiveWebContents();
2651 if (!web_contents) 2651 if (!web_contents)
2652 return nullptr; 2652 return nullptr;
2653 return extensions::TabHelper::FromWebContents(web_contents) 2653 return extensions::TabHelper::FromWebContents(web_contents)
2654 ->active_tab_permission_granter(); 2654 ->active_tab_permission_granter();
2655 } 2655 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/tab_helpers.cc ('k') | chrome/browser/ui/website_settings/mock_permission_bubble_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698