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 <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" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
17 #include "chrome/app/chrome_dll_resource.h" | 17 #include "chrome/app/chrome_dll_resource.h" |
18 #include "chrome/browser/app_mode/app_mode_utils.h" | 18 #include "chrome/browser/app_mode/app_mode_utils.h" |
19 #include "chrome/browser/bookmarks/bookmark_stats.h" | 19 #include "chrome/browser/bookmarks/bookmark_stats.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
| 22 #include "chrome/browser/extensions/extension_util.h" |
22 #include "chrome/browser/extensions/tab_helper.h" | 23 #include "chrome/browser/extensions/tab_helper.h" |
23 #include "chrome/browser/infobars/infobar_service.h" | 24 #include "chrome/browser/infobars/infobar_service.h" |
24 #include "chrome/browser/native_window_notification_source.h" | 25 #include "chrome/browser/native_window_notification_source.h" |
25 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 26 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
26 #include "chrome/browser/profiles/avatar_menu.h" | 27 #include "chrome/browser/profiles/avatar_menu.h" |
27 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
28 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 29 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
29 #include "chrome/browser/profiles/profile_info_cache.h" | 30 #include "chrome/browser/profiles/profile_info_cache.h" |
30 #include "chrome/browser/profiles/profile_manager.h" | 31 #include "chrome/browser/profiles/profile_manager.h" |
31 #include "chrome/browser/profiles/profiles_state.h" | 32 #include "chrome/browser/profiles/profiles_state.h" |
(...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 views::View* BrowserView::GetInitiallyFocusedView() { | 1539 views::View* BrowserView::GetInitiallyFocusedView() { |
1539 return NULL; | 1540 return NULL; |
1540 } | 1541 } |
1541 | 1542 |
1542 bool BrowserView::ShouldShowWindowTitle() const { | 1543 bool BrowserView::ShouldShowWindowTitle() const { |
1543 // For Ash only, trusted windows (apps and settings) do not show an icon, | 1544 // For Ash only, trusted windows (apps and settings) do not show an icon, |
1544 // crbug.com/119411. Child windows (i.e. popups) do show an icon. | 1545 // crbug.com/119411. Child windows (i.e. popups) do show an icon. |
1545 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && | 1546 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && |
1546 browser_->is_trusted_source() && | 1547 browser_->is_trusted_source() && |
1547 !(browser_->is_app() && | 1548 !(browser_->is_app() && |
1548 CommandLine::ForCurrentProcess()->HasSwitch( | 1549 extensions::util::IsStreamlinedHostedAppsEnabled())) |
1549 switches::kEnableStreamlinedHostedApps))) | |
1550 return false; | 1550 return false; |
1551 | 1551 |
1552 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); | 1552 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); |
1553 } | 1553 } |
1554 | 1554 |
1555 gfx::ImageSkia BrowserView::GetWindowAppIcon() { | 1555 gfx::ImageSkia BrowserView::GetWindowAppIcon() { |
1556 if (browser_->is_app()) { | 1556 if (browser_->is_app()) { |
1557 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); | 1557 WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents(); |
1558 extensions::TabHelper* extensions_tab_helper = | 1558 extensions::TabHelper* extensions_tab_helper = |
1559 contents ? extensions::TabHelper::FromWebContents(contents) : NULL; | 1559 contents ? extensions::TabHelper::FromWebContents(contents) : NULL; |
(...skipping 10 matching lines...) Expand all Loading... |
1570 return browser_->GetCurrentPageIcon().AsImageSkia(); | 1570 return browser_->GetCurrentPageIcon().AsImageSkia(); |
1571 return gfx::ImageSkia(); | 1571 return gfx::ImageSkia(); |
1572 } | 1572 } |
1573 | 1573 |
1574 bool BrowserView::ShouldShowWindowIcon() const { | 1574 bool BrowserView::ShouldShowWindowIcon() const { |
1575 // For Ash only, trusted windows (apps and settings) do not show an icon, | 1575 // For Ash only, trusted windows (apps and settings) do not show an icon, |
1576 // crbug.com/119411. Child windows (i.e. popups) do show an icon. | 1576 // crbug.com/119411. Child windows (i.e. popups) do show an icon. |
1577 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && | 1577 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH && |
1578 browser_->is_trusted_source() && | 1578 browser_->is_trusted_source() && |
1579 !(browser_->is_app() && | 1579 !(browser_->is_app() && |
1580 CommandLine::ForCurrentProcess()->HasSwitch( | 1580 extensions::util::IsStreamlinedHostedAppsEnabled())) |
1581 switches::kEnableStreamlinedHostedApps))) | |
1582 return false; | 1581 return false; |
1583 | 1582 |
1584 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); | 1583 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); |
1585 } | 1584 } |
1586 | 1585 |
1587 bool BrowserView::ExecuteWindowsCommand(int command_id) { | 1586 bool BrowserView::ExecuteWindowsCommand(int command_id) { |
1588 // This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND. | 1587 // This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND. |
1589 #if defined(OS_WIN) | 1588 #if defined(OS_WIN) |
1590 if (command_id == IDC_DEBUG_FRAME_TOGGLE) | 1589 if (command_id == IDC_DEBUG_FRAME_TOGGLE) |
1591 GetWidget()->DebugToggleFrameType(); | 1590 GetWidget()->DebugToggleFrameType(); |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2557 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2556 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2558 gfx::Point icon_bottom( | 2557 gfx::Point icon_bottom( |
2559 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2558 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2560 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2559 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2561 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2560 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2562 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2561 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2563 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2562 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2564 } | 2563 } |
2565 return top_arrow_height; | 2564 return top_arrow_height; |
2566 } | 2565 } |
OLD | NEW |