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

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

Issue 2552903003: Remove unreleased web app frame code from ChromeOS (Closed)
Patch Set: 'nother bit Created 4 years 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 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 toolbar_->reload_button()->ChangeMode( 1028 toolbar_->reload_button()->ChangeMode(
1029 is_loading ? ReloadButton::MODE_STOP : ReloadButton::MODE_RELOAD, 1029 is_loading ? ReloadButton::MODE_STOP : ReloadButton::MODE_RELOAD,
1030 force); 1030 force);
1031 } 1031 }
1032 } 1032 }
1033 1033
1034 void BrowserView::UpdateToolbar(content::WebContents* contents) { 1034 void BrowserView::UpdateToolbar(content::WebContents* contents) {
1035 // We may end up here during destruction. 1035 // We may end up here during destruction.
1036 if (toolbar_) 1036 if (toolbar_)
1037 toolbar_->Update(contents); 1037 toolbar_->Update(contents);
1038 frame_->UpdateToolbar();
1039 } 1038 }
1040 1039
1041 void BrowserView::ResetToolbarTabState(content::WebContents* contents) { 1040 void BrowserView::ResetToolbarTabState(content::WebContents* contents) {
1042 // We may end up here during destruction. 1041 // We may end up here during destruction.
1043 if (toolbar_) 1042 if (toolbar_)
1044 toolbar_->ResetTabState(contents); 1043 toolbar_->ResetTabState(contents);
1045 } 1044 }
1046 1045
1047 void BrowserView::FocusToolbar() { 1046 void BrowserView::FocusToolbar() {
1048 // Temporarily reveal the top-of-window views (if not already revealed) so 1047 // Temporarily reveal the top-of-window views (if not already revealed) so
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 1275
1277 void BrowserView::UserChangedTheme() { 1276 void BrowserView::UserChangedTheme() {
1278 frame_->FrameTypeChanged(); 1277 frame_->FrameTypeChanged();
1279 } 1278 }
1280 1279
1281 void BrowserView::ShowWebsiteSettings( 1280 void BrowserView::ShowWebsiteSettings(
1282 Profile* profile, 1281 Profile* profile,
1283 content::WebContents* web_contents, 1282 content::WebContents* web_contents,
1284 const GURL& virtual_url, 1283 const GURL& virtual_url,
1285 const security_state::SecurityInfo& security_info) { 1284 const security_state::SecurityInfo& security_info) {
1286 // Some browser windows have a location icon embedded in the frame. Try to 1285 views::View* popup_anchor = nullptr;
1287 // use that if it exists. If it doesn't exist, use the location icon from 1286 if (ui::MaterialDesignController::IsSecondaryUiMaterial())
1288 // the location bar. 1287 popup_anchor = toolbar_->location_bar();
1289 views::View* popup_anchor = 1288 else
tapted 2016/12/16 03:30:36 this logic isn't quite the same, but I guess locat
benwells 2016/12/19 03:59:06 Yep, that was my thinking. I think this is clearer
1290 ui::MaterialDesignController::IsSecondaryUiMaterial()
1291 ? toolbar_->location_bar()
1292 : frame_->GetLocationIconView();
1293 if (!popup_anchor)
1294 popup_anchor = GetLocationBarView()->location_icon_view()->GetImageView(); 1289 popup_anchor = GetLocationBarView()->location_icon_view()->GetImageView();
1295 1290
1296 WebsiteSettingsPopupView::ShowPopup(popup_anchor, gfx::Rect(), profile, 1291 WebsiteSettingsPopupView::ShowPopup(popup_anchor, gfx::Rect(), profile,
1297 web_contents, virtual_url, security_info); 1292 web_contents, virtual_url, security_info);
1298 } 1293 }
1299 1294
1300 void BrowserView::ShowAppMenu() { 1295 void BrowserView::ShowAppMenu() {
1301 if (!toolbar_->app_menu_button()) 1296 if (!toolbar_->app_menu_button())
1302 return; 1297 return;
1303 1298
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 } 1651 }
1657 1652
1658 views::View* BrowserView::GetInitiallyFocusedView() { 1653 views::View* BrowserView::GetInitiallyFocusedView() {
1659 return nullptr; 1654 return nullptr;
1660 } 1655 }
1661 1656
1662 bool BrowserView::ShouldShowWindowTitle() const { 1657 bool BrowserView::ShouldShowWindowTitle() const {
1663 #if defined(USE_ASH) 1658 #if defined(USE_ASH)
1664 // For Ash only, trusted windows (apps and settings) do not show a title, 1659 // For Ash only, trusted windows (apps and settings) do not show a title,
1665 // crbug.com/119411. Child windows (i.e. popups) do show a title. 1660 // crbug.com/119411. Child windows (i.e. popups) do show a title.
1666 if (browser_->is_trusted_source() && 1661 if (browser_->is_trusted_source())
1667 !browser_->SupportsWindowFeature(Browser::FEATURE_WEBAPPFRAME))
1668 return false; 1662 return false;
1669 #endif // USE_ASH 1663 #endif // USE_ASH
1670 1664
1671 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); 1665 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR);
1672 } 1666 }
1673 1667
1674 gfx::ImageSkia BrowserView::GetWindowAppIcon() { 1668 gfx::ImageSkia BrowserView::GetWindowAppIcon() {
1675 if (browser_->is_app()) { 1669 if (browser_->is_app()) {
1676 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); 1670 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents();
1677 extensions::TabHelper* extensions_tab_helper = 1671 extensions::TabHelper* extensions_tab_helper =
(...skipping 13 matching lines...) Expand all
1691 1685
1692 if (browser_->is_app() || browser_->is_type_popup()) 1686 if (browser_->is_app() || browser_->is_type_popup())
1693 return browser_->GetCurrentPageIcon().AsImageSkia(); 1687 return browser_->GetCurrentPageIcon().AsImageSkia();
1694 return gfx::ImageSkia(); 1688 return gfx::ImageSkia();
1695 } 1689 }
1696 1690
1697 bool BrowserView::ShouldShowWindowIcon() const { 1691 bool BrowserView::ShouldShowWindowIcon() const {
1698 #if defined(USE_ASH) 1692 #if defined(USE_ASH)
1699 // For Ash only, trusted windows (apps and settings) do not show an icon, 1693 // For Ash only, trusted windows (apps and settings) do not show an icon,
1700 // crbug.com/119411. Child windows (i.e. popups) do show an icon. 1694 // crbug.com/119411. Child windows (i.e. popups) do show an icon.
1701 if (browser_->is_trusted_source() && 1695 if (browser_->is_trusted_source())
1702 !browser_->SupportsWindowFeature(Browser::FEATURE_WEBAPPFRAME))
1703 return false; 1696 return false;
1704 #endif // USE_ASH 1697 #endif // USE_ASH
1705 1698
1706 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); 1699 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR);
1707 } 1700 }
1708 1701
1709 bool BrowserView::ExecuteWindowsCommand(int command_id) { 1702 bool BrowserView::ExecuteWindowsCommand(int command_id) {
1710 // This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND. 1703 // This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND.
1711 #if defined(OS_WIN) 1704 #if defined(OS_WIN)
1712 if (command_id == IDC_DEBUG_FRAME_TOGGLE) 1705 if (command_id == IDC_DEBUG_FRAME_TOGGLE)
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
2644 } 2637 }
2645 2638
2646 extensions::ActiveTabPermissionGranter* 2639 extensions::ActiveTabPermissionGranter*
2647 BrowserView::GetActiveTabPermissionGranter() { 2640 BrowserView::GetActiveTabPermissionGranter() {
2648 content::WebContents* web_contents = GetActiveWebContents(); 2641 content::WebContents* web_contents = GetActiveWebContents();
2649 if (!web_contents) 2642 if (!web_contents)
2650 return nullptr; 2643 return nullptr;
2651 return extensions::TabHelper::FromWebContents(web_contents) 2644 return extensions::TabHelper::FromWebContents(web_contents)
2652 ->active_tab_permission_granter(); 2645 ->active_tab_permission_granter();
2653 } 2646 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698