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

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

Issue 7834048: Preliminary work to allow Chrome to build with USE_AURA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #if defined(TOOLKIT_USES_GTK) 7 #if defined(TOOLKIT_USES_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 #include "views/controls/single_split_view.h" 98 #include "views/controls/single_split_view.h"
99 #include "views/events/event.h" 99 #include "views/events/event.h"
100 #include "views/focus/external_focus_tracker.h" 100 #include "views/focus/external_focus_tracker.h"
101 #include "views/focus/view_storage.h" 101 #include "views/focus/view_storage.h"
102 #include "views/layout/grid_layout.h" 102 #include "views/layout/grid_layout.h"
103 #include "views/widget/native_widget.h" 103 #include "views/widget/native_widget.h"
104 #include "views/widget/root_view.h" 104 #include "views/widget/root_view.h"
105 #include "views/widget/widget.h" 105 #include "views/widget/widget.h"
106 #include "views/window/dialog_delegate.h" 106 #include "views/window/dialog_delegate.h"
107 107
108 #if defined(OS_WIN) 108 #if defined(USE_AURA)
109 #elif defined(OS_WIN)
109 #include "chrome/browser/aeropeek_manager.h" 110 #include "chrome/browser/aeropeek_manager.h"
110 #include "chrome/browser/jumplist_win.h" 111 #include "chrome/browser/jumplist_win.h"
111 #include "ui/base/message_box_win.h" 112 #include "ui/base/message_box_win.h"
112 #include "ui/base/view_prop.h" 113 #include "ui/base/view_prop.h"
113 #include "views/widget/native_widget_win.h" 114 #include "views/widget/native_widget_win.h"
114 #elif defined(TOOLKIT_USES_GTK) 115 #elif defined(TOOLKIT_USES_GTK)
115 #include "chrome/browser/ui/views/accelerator_table_gtk.h" 116 #include "chrome/browser/ui/views/accelerator_table_gtk.h"
116 #include "views/window/hit_test.h" 117 #include "views/window/hit_test.h"
117 #if !defined(TOUCH_UI) 118 #if !defined(TOUCH_UI)
118 #include "chrome/browser/ui/views/handle_web_keyboard_event_gtk.h" 119 #include "chrome/browser/ui/views/handle_web_keyboard_event_gtk.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 infobar_container_(NULL), 324 infobar_container_(NULL),
324 sidebar_container_(NULL), 325 sidebar_container_(NULL),
325 sidebar_split_(NULL), 326 sidebar_split_(NULL),
326 contents_container_(NULL), 327 contents_container_(NULL),
327 devtools_container_(NULL), 328 devtools_container_(NULL),
328 preview_container_(NULL), 329 preview_container_(NULL),
329 contents_(NULL), 330 contents_(NULL),
330 contents_split_(NULL), 331 contents_split_(NULL),
331 initialized_(false), 332 initialized_(false),
332 ignore_layout_(true) 333 ignore_layout_(true)
333 #if defined(OS_WIN) 334 #if defined(OS_WIN) && !defined(USE_AURA)
334 , hung_window_detector_(&hung_plugin_action_), 335 , hung_window_detector_(&hung_plugin_action_),
335 ticker_(0) 336 ticker_(0)
336 #endif 337 #endif
337 { 338 {
338 browser_->tabstrip_model()->AddObserver(this); 339 browser_->tabstrip_model()->AddObserver(this);
339 340
340 registrar_.Add(this, 341 registrar_.Add(this,
341 chrome::NOTIFICATION_SIDEBAR_CHANGED, 342 chrome::NOTIFICATION_SIDEBAR_CHANGED,
342 Source<SidebarManager>(SidebarManager::GetInstance())); 343 Source<SidebarManager>(SidebarManager::GetInstance()));
343 } 344 }
344 345
345 BrowserView::~BrowserView() { 346 BrowserView::~BrowserView() {
346 browser_->tabstrip_model()->RemoveObserver(this); 347 browser_->tabstrip_model()->RemoveObserver(this);
347 348
348 #if defined(OS_WIN) 349 #if defined(OS_WIN) && !defined(USE_AURA)
349 // Remove this observer. 350 // Remove this observer.
350 if (aeropeek_manager_.get()) 351 if (aeropeek_manager_.get())
351 browser_->tabstrip_model()->RemoveObserver(aeropeek_manager_.get()); 352 browser_->tabstrip_model()->RemoveObserver(aeropeek_manager_.get());
352 353
353 // Stop hung plugin monitoring. 354 // Stop hung plugin monitoring.
354 ticker_.Stop(); 355 ticker_.Stop();
355 ticker_.UnregisterTickHandler(&hung_window_detector_); 356 ticker_.UnregisterTickHandler(&hung_window_detector_);
356 357
357 // Terminate the jumplist (must be called before browser_->profile() is 358 // Terminate the jumplist (must be called before browser_->profile() is
358 // destroyed. 359 // destroyed.
(...skipping 20 matching lines...) Expand all
379 // Child views maintain PrefMember attributes that point to 380 // Child views maintain PrefMember attributes that point to
380 // OffTheRecordProfile's PrefService which gets deleted by ~Browser. 381 // OffTheRecordProfile's PrefService which gets deleted by ~Browser.
381 RemoveAllChildViews(true); 382 RemoveAllChildViews(true);
382 // Explicitly set browser_ to NULL. 383 // Explicitly set browser_ to NULL.
383 browser_.reset(); 384 browser_.reset();
384 } 385 }
385 386
386 // static 387 // static
387 BrowserView* BrowserView::GetBrowserViewForNativeWindow( 388 BrowserView* BrowserView::GetBrowserViewForNativeWindow(
388 gfx::NativeWindow window) { 389 gfx::NativeWindow window) {
389 #if defined(OS_WIN) 390 #if defined(USE_AURA)
391 // TODO(beng):
392 NOTIMPLEMENTED();
393 #elif defined(OS_WIN)
390 if (IsWindow(window)) { 394 if (IsWindow(window)) {
391 return reinterpret_cast<BrowserView*>( 395 return reinterpret_cast<BrowserView*>(
392 ui::ViewProp::GetValue(window, kBrowserViewKey)); 396 ui::ViewProp::GetValue(window, kBrowserViewKey));
393 } 397 }
394 #else 398 #else
395 if (window) { 399 if (window) {
396 return static_cast<BrowserView*>( 400 return static_cast<BrowserView*>(
397 g_object_get_data(G_OBJECT(window), kBrowserViewKey)); 401 g_object_get_data(G_OBJECT(window), kBrowserViewKey));
398 } 402 }
399 #endif 403 #endif
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 SkBitmap BrowserView::GetOTRAvatarIcon() { 571 SkBitmap BrowserView::GetOTRAvatarIcon() {
568 static SkBitmap* otr_avatar_ = new SkBitmap(); 572 static SkBitmap* otr_avatar_ = new SkBitmap();
569 573
570 if (otr_avatar_->isNull()) { 574 if (otr_avatar_->isNull()) {
571 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 575 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
572 *otr_avatar_ = *rb.GetBitmapNamed(IDR_OTR_ICON); 576 *otr_avatar_ = *rb.GetBitmapNamed(IDR_OTR_ICON);
573 } 577 }
574 return *otr_avatar_; 578 return *otr_avatar_;
575 } 579 }
576 580
577 #if defined(OS_WIN) 581 #if defined(OS_WIN) && !defined(USE_AURA)
578 void BrowserView::PrepareToRunSystemMenu(HMENU menu) { 582 void BrowserView::PrepareToRunSystemMenu(HMENU menu) {
579 system_menu_->UpdateStates(); 583 system_menu_->UpdateStates();
580 } 584 }
581 #endif 585 #endif
582 586
583 // static 587 // static
584 void BrowserView::RegisterBrowserViewPrefs(PrefService* prefs) { 588 void BrowserView::RegisterBrowserViewPrefs(PrefService* prefs) {
585 prefs->RegisterIntegerPref(prefs::kPluginMessageResponseTimeout, 589 prefs->RegisterIntegerPref(prefs::kPluginMessageResponseTimeout,
586 kDefaultPluginMessageResponseTimeout); 590 kDefaultPluginMessageResponseTimeout);
587 prefs->RegisterIntegerPref(prefs::kHungPluginDetectFrequency, 591 prefs->RegisterIntegerPref(prefs::kHungPluginDetectFrequency,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 652
649 void BrowserView::Deactivate() { 653 void BrowserView::Deactivate() {
650 frame_->Deactivate(); 654 frame_->Deactivate();
651 } 655 }
652 656
653 bool BrowserView::IsActive() const { 657 bool BrowserView::IsActive() const {
654 return frame_->IsActive(); 658 return frame_->IsActive();
655 } 659 }
656 660
657 void BrowserView::FlashFrame() { 661 void BrowserView::FlashFrame() {
658 #if defined(OS_WIN) 662 #if defined(OS_WIN) && !defined(USE_AURA)
659 FLASHWINFO fwi; 663 FLASHWINFO fwi;
660 fwi.cbSize = sizeof(fwi); 664 fwi.cbSize = sizeof(fwi);
661 fwi.hwnd = frame_->GetNativeWindow(); 665 fwi.hwnd = frame_->GetNativeWindow();
662 fwi.dwFlags = FLASHW_ALL; 666 fwi.dwFlags = FLASHW_ALL;
663 fwi.uCount = 4; 667 fwi.uCount = 4;
664 fwi.dwTimeout = 0; 668 fwi.dwTimeout = 0;
665 FlashWindowEx(&fwi); 669 FlashWindowEx(&fwi);
666 #else 670 #else
667 // Doesn't matter for chrome os. 671 // Doesn't matter for chrome os.
668 #endif 672 #endif
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 } 794 }
791 795
792 bool BrowserView::IsMinimized() const { 796 bool BrowserView::IsMinimized() const {
793 return frame_->IsMinimized(); 797 return frame_->IsMinimized();
794 } 798 }
795 799
796 void BrowserView::SetFullscreen(bool fullscreen) { 800 void BrowserView::SetFullscreen(bool fullscreen) {
797 if (IsFullscreen() == fullscreen) 801 if (IsFullscreen() == fullscreen)
798 return; // Nothing to do. 802 return; // Nothing to do.
799 803
800 #if defined(OS_WIN) 804 #if defined(OS_WIN) && !defined(USE_AURA)
801 ProcessFullscreen(fullscreen); 805 ProcessFullscreen(fullscreen);
802 #else 806 #else
803 // On Linux changing fullscreen is async. Ask the window to change it's 807 // On Linux changing fullscreen is async. Ask the window to change it's
804 // fullscreen state, and when done invoke ProcessFullscreen. 808 // fullscreen state, and when done invoke ProcessFullscreen.
805 frame_->SetFullscreen(fullscreen); 809 frame_->SetFullscreen(fullscreen);
806 #endif 810 #endif
807 } 811 }
808 812
809 bool BrowserView::IsFullscreen() const { 813 bool BrowserView::IsFullscreen() const {
810 return frame_->IsFullscreen(); 814 return frame_->IsFullscreen();
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 bool BrowserView::IsToolbarVisible() const { 1011 bool BrowserView::IsToolbarVisible() const {
1008 if (UseCompactNavigationBar()) { 1012 if (UseCompactNavigationBar()) {
1009 return false; 1013 return false;
1010 } else { 1014 } else {
1011 return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) || 1015 return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) ||
1012 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR); 1016 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR);
1013 } 1017 }
1014 } 1018 }
1015 1019
1016 void BrowserView::DisableInactiveFrame() { 1020 void BrowserView::DisableInactiveFrame() {
1017 #if defined(OS_WIN) 1021 #if defined(OS_WIN) && !defined(USE_AURA)
1018 frame_->DisableInactiveRendering(); 1022 frame_->DisableInactiveRendering();
1019 #endif // No tricks are needed to get the right behavior on Linux. 1023 #endif // No tricks are needed to get the right behavior on Linux.
1020 } 1024 }
1021 1025
1022 void BrowserView::ConfirmSetDefaultSearchProvider( 1026 void BrowserView::ConfirmSetDefaultSearchProvider(
1023 TabContents* tab_contents, 1027 TabContents* tab_contents,
1024 TemplateURL* template_url, 1028 TemplateURL* template_url,
1025 TemplateURLService* template_url_service) { 1029 TemplateURLService* template_url_service) {
1026 #if defined(OS_WIN) 1030 #if defined(OS_WIN) && !defined(USE_AURA)
1027 DefaultSearchView::Show(tab_contents, template_url, template_url_service); 1031 DefaultSearchView::Show(tab_contents, template_url, template_url_service);
1028 #else 1032 #else
1029 // TODO(levin): Implement for other platforms. Right now this is behind 1033 // TODO(levin): Implement for other platforms. Right now this is behind
1030 // a command line flag which is off. http://crbug.com/38475 1034 // a command line flag which is off. http://crbug.com/38475
1031 #endif 1035 #endif
1032 } 1036 }
1033 1037
1034 void BrowserView::ConfirmAddSearchProvider(const TemplateURL* template_url, 1038 void BrowserView::ConfirmAddSearchProvider(const TemplateURL* template_url,
1035 Profile* profile) { 1039 Profile* profile) {
1036 browser::EditSearchEngine(GetWidget()->GetNativeWindow(), template_url, NULL, 1040 browser::EditSearchEngine(GetWidget()->GetNativeWindow(), template_url, NULL,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 void BrowserView::ShowAppMenu() { 1206 void BrowserView::ShowAppMenu() {
1203 // TODO(mad): find out how to add this to compact nav view. 1207 // TODO(mad): find out how to add this to compact nav view.
1204 toolbar_->app_menu()->Activate(); 1208 toolbar_->app_menu()->Activate();
1205 } 1209 }
1206 1210
1207 bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, 1211 bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
1208 bool* is_keyboard_shortcut) { 1212 bool* is_keyboard_shortcut) {
1209 if (event.type != WebKit::WebInputEvent::RawKeyDown) 1213 if (event.type != WebKit::WebInputEvent::RawKeyDown)
1210 return false; 1214 return false;
1211 1215
1212 #if defined(OS_WIN) 1216 #if defined(OS_WIN) && !defined(USE_AURA)
1213 // As Alt+F4 is the close-app keyboard shortcut, it needs processing 1217 // As Alt+F4 is the close-app keyboard shortcut, it needs processing
1214 // immediately. 1218 // immediately.
1215 if (event.windowsKeyCode == ui::VKEY_F4 && 1219 if (event.windowsKeyCode == ui::VKEY_F4 &&
1216 event.modifiers == NativeWebKeyboardEvent::AltKey) { 1220 event.modifiers == NativeWebKeyboardEvent::AltKey) {
1217 DefWindowProc(event.os_event.hwnd, event.os_event.message, 1221 DefWindowProc(event.os_event.hwnd, event.os_event.message,
1218 event.os_event.wParam, event.os_event.lParam); 1222 event.os_event.wParam, event.os_event.lParam);
1219 return true; 1223 return true;
1220 } 1224 }
1221 #endif 1225 #endif
1222 1226
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 void BrowserView::PrepareForInstant() { 1344 void BrowserView::PrepareForInstant() {
1341 contents_->FadeActiveContents(); 1345 contents_->FadeActiveContents();
1342 } 1346 }
1343 1347
1344 void BrowserView::ShowInstant(TabContentsWrapper* preview) { 1348 void BrowserView::ShowInstant(TabContentsWrapper* preview) {
1345 if (!preview_container_) 1349 if (!preview_container_)
1346 preview_container_ = new TabContentsContainer(); 1350 preview_container_ = new TabContentsContainer();
1347 contents_->SetPreview(preview_container_, preview->tab_contents()); 1351 contents_->SetPreview(preview_container_, preview->tab_contents());
1348 preview_container_->ChangeTabContents(preview->tab_contents()); 1352 preview_container_->ChangeTabContents(preview->tab_contents());
1349 1353
1350 #if defined(OS_WIN) 1354 #if defined(OS_WIN) && !defined(USE_AURA)
1351 // Removing the fade is instant (on windows). We need to force the preview to 1355 // Removing the fade is instant (on windows). We need to force the preview to
1352 // draw, otherwise the current page flickers before the new page appears. 1356 // draw, otherwise the current page flickers before the new page appears.
1353 RedrawWindow(preview->tab_contents()->view()->GetContentNativeView(), NULL, 1357 RedrawWindow(preview->tab_contents()->view()->GetContentNativeView(), NULL,
1354 NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN); 1358 NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN);
1355 #endif 1359 #endif
1356 1360
1357 contents_->RemoveFade(); 1361 contents_->RemoveFade();
1358 } 1362 }
1359 1363
1360 void BrowserView::HideInstant(bool instant_is_active) { 1364 void BrowserView::HideInstant(bool instant_is_active) {
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 return browser_->GetCurrentPageIcon(); 1611 return browser_->GetCurrentPageIcon();
1608 return SkBitmap(); 1612 return SkBitmap();
1609 } 1613 }
1610 1614
1611 bool BrowserView::ShouldShowWindowIcon() const { 1615 bool BrowserView::ShouldShowWindowIcon() const {
1612 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); 1616 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR);
1613 } 1617 }
1614 1618
1615 bool BrowserView::ExecuteWindowsCommand(int command_id) { 1619 bool BrowserView::ExecuteWindowsCommand(int command_id) {
1616 // This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND. 1620 // This function handles WM_SYSCOMMAND, WM_APPCOMMAND, and WM_COMMAND.
1617 #if defined(OS_WIN) 1621 #if defined(OS_WIN) && !defined(USE_AURA)
1618 if (command_id == IDC_DEBUG_FRAME_TOGGLE) 1622 if (command_id == IDC_DEBUG_FRAME_TOGGLE)
1619 GetWidget()->DebugToggleFrameType(); 1623 GetWidget()->DebugToggleFrameType();
1620 #endif 1624 #endif
1621 // Translate WM_APPCOMMAND command ids into a command id that the browser 1625 // Translate WM_APPCOMMAND command ids into a command id that the browser
1622 // knows how to handle. 1626 // knows how to handle.
1623 int command_id_from_app_command = GetCommandIDForAppCommandID(command_id); 1627 int command_id_from_app_command = GetCommandIDForAppCommandID(command_id);
1624 if (command_id_from_app_command != -1) 1628 if (command_id_from_app_command != -1)
1625 command_id = command_id_from_app_command; 1629 command_id = command_id_from_app_command;
1626 1630
1627 return browser_->ExecuteCommandIfEnabled(command_id); 1631 return browser_->ExecuteCommandIfEnabled(command_id);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 1773
1770 // Empty TabStripModel, it's now safe to allow the Window to be closed. 1774 // Empty TabStripModel, it's now safe to allow the Window to be closed.
1771 NotificationService::current()->Notify( 1775 NotificationService::current()->Notify(
1772 chrome::NOTIFICATION_WINDOW_CLOSED, 1776 chrome::NOTIFICATION_WINDOW_CLOSED,
1773 Source<gfx::NativeWindow>(frame_->GetNativeWindow()), 1777 Source<gfx::NativeWindow>(frame_->GetNativeWindow()),
1774 NotificationService::NoDetails()); 1778 NotificationService::NoDetails());
1775 return true; 1779 return true;
1776 } 1780 }
1777 1781
1778 int BrowserView::NonClientHitTest(const gfx::Point& point) { 1782 int BrowserView::NonClientHitTest(const gfx::Point& point) {
1779 #if defined(OS_WIN) 1783 #if defined(OS_WIN) && !defined(USE_AURA)
1780 // The following code is not in the LayoutManager because it's 1784 // The following code is not in the LayoutManager because it's
1781 // independent of layout and also depends on the ResizeCorner which 1785 // independent of layout and also depends on the ResizeCorner which
1782 // is private. 1786 // is private.
1783 if (!frame_->IsMaximized() && !frame_->IsFullscreen()) { 1787 if (!frame_->IsMaximized() && !frame_->IsFullscreen()) {
1784 CRect client_rect; 1788 CRect client_rect;
1785 ::GetClientRect(frame_->GetNativeWindow(), &client_rect); 1789 ::GetClientRect(frame_->GetNativeWindow(), &client_rect);
1786 gfx::Size resize_corner_size = ResizeCorner::GetSize(); 1790 gfx::Size resize_corner_size = ResizeCorner::GetSize();
1787 gfx::Rect resize_corner_rect(client_rect.right - resize_corner_size.width(), 1791 gfx::Rect resize_corner_rect(client_rect.right - resize_corner_size.width(),
1788 client_rect.bottom - resize_corner_size.height(), 1792 client_rect.bottom - resize_corner_size.height(),
1789 resize_corner_size.width(), resize_corner_size.height()); 1793 resize_corner_size.width(), resize_corner_size.height());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1832 } 1836 }
1833 1837
1834 void BrowserView::Layout() { 1838 void BrowserView::Layout() {
1835 if (ignore_layout_) 1839 if (ignore_layout_)
1836 return; 1840 return;
1837 views::View::Layout(); 1841 views::View::Layout();
1838 1842
1839 // The status bubble position requires that all other layout finish first. 1843 // The status bubble position requires that all other layout finish first.
1840 LayoutStatusBubble(); 1844 LayoutStatusBubble();
1841 1845
1842 #if defined(OS_WIN) 1846 #if defined(OS_WIN) && !defined(USE_AURA)
1843 // Send the margins of the "user-perceived content area" of this 1847 // Send the margins of the "user-perceived content area" of this
1844 // browser window so AeroPeekManager can render a background-tab image in 1848 // browser window so AeroPeekManager can render a background-tab image in
1845 // the area. 1849 // the area.
1846 // TODO(pkasting) correct content inset?? 1850 // TODO(pkasting) correct content inset??
1847 if (aeropeek_manager_.get()) { 1851 if (aeropeek_manager_.get()) {
1848 gfx::Insets insets(GetFindBarBoundingBox().y() + 1, 1852 gfx::Insets insets(GetFindBarBoundingBox().y() + 1,
1849 0, 1853 0,
1850 0, 1854 0,
1851 0); 1855 0);
1852 aeropeek_manager_->SetContentInsets(insets); 1856 aeropeek_manager_->SetContentInsets(insets);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 contents_split_->set_id(VIEW_ID_CONTENTS_SPLIT); 2003 contents_split_->set_id(VIEW_ID_CONTENTS_SPLIT);
2000 contents_split_->SetAccessibleName( 2004 contents_split_->SetAccessibleName(
2001 l10n_util::GetStringUTF16(IDS_ACCNAME_WEB_CONTENTS)); 2005 l10n_util::GetStringUTF16(IDS_ACCNAME_WEB_CONTENTS));
2002 contents_split_->set_background( 2006 contents_split_->set_background(
2003 views::Background::CreateSolidBackground(bg_color)); 2007 views::Background::CreateSolidBackground(bg_color));
2004 AddChildView(contents_split_); 2008 AddChildView(contents_split_);
2005 set_contents_view(contents_split_); 2009 set_contents_view(contents_split_);
2006 2010
2007 status_bubble_.reset(new StatusBubbleViews(contents_)); 2011 status_bubble_.reset(new StatusBubbleViews(contents_));
2008 2012
2009 #if defined(OS_WIN) 2013 #if defined(OS_WIN) && !defined(USE_AURA)
2010 InitSystemMenu(); 2014 InitSystemMenu();
2011 2015
2012 // Create a custom JumpList and add it to an observer of TabRestoreService 2016 // Create a custom JumpList and add it to an observer of TabRestoreService
2013 // so we can update the custom JumpList when a tab is added or removed. 2017 // so we can update the custom JumpList when a tab is added or removed.
2014 if (JumpList::Enabled()) { 2018 if (JumpList::Enabled()) {
2015 jumplist_ = new JumpList(); 2019 jumplist_ = new JumpList();
2016 jumplist_->AddObserver(browser_->profile()); 2020 jumplist_->AddObserver(browser_->profile());
2017 } 2021 }
2018 2022
2019 if (AeroPeekManager::Enabled()) { 2023 if (AeroPeekManager::Enabled()) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 TabContents* tab_contents = browser_->GetSelectedTabContents(); 2076 TabContents* tab_contents = browser_->GetSelectedTabContents();
2073 // GetSelectedTabContents can return NULL for example under Purify when 2077 // GetSelectedTabContents can return NULL for example under Purify when
2074 // the animations are running slowly and this function is called on a timer 2078 // the animations are running slowly and this function is called on a timer
2075 // through LoadingAnimationCallback. 2079 // through LoadingAnimationCallback.
2076 frame_->UpdateThrobber(tab_contents && tab_contents->IsLoading()); 2080 frame_->UpdateThrobber(tab_contents && tab_contents->IsLoading());
2077 } 2081 }
2078 } 2082 }
2079 2083
2080 // BrowserView, private -------------------------------------------------------- 2084 // BrowserView, private --------------------------------------------------------
2081 2085
2082 #if defined(OS_WIN) 2086 #if defined(OS_WIN) && !defined(USE_AURA)
2083 void BrowserView::InitSystemMenu() { 2087 void BrowserView::InitSystemMenu() {
2084 system_menu_contents_.reset(new views::SystemMenuModel(this)); 2088 system_menu_contents_.reset(new views::SystemMenuModel(this));
2085 // We add the menu items in reverse order so that insertion_index never needs 2089 // We add the menu items in reverse order so that insertion_index never needs
2086 // to change. 2090 // to change.
2087 if (IsBrowserTypeNormal()) 2091 if (IsBrowserTypeNormal())
2088 BuildSystemMenuForBrowserWindow(); 2092 BuildSystemMenuForBrowserWindow();
2089 else 2093 else
2090 BuildSystemMenuForAppOrPopupWindow(); 2094 BuildSystemMenuForAppOrPopupWindow();
2091 system_menu_.reset( 2095 system_menu_.reset(
2092 new views::NativeMenuWin(system_menu_contents_.get(), 2096 new views::NativeMenuWin(system_menu_contents_.get(),
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2310 return changed; 2314 return changed;
2311 } 2315 }
2312 2316
2313 void BrowserView::ProcessFullscreen(bool fullscreen) { 2317 void BrowserView::ProcessFullscreen(bool fullscreen) {
2314 // Reduce jankiness during the following position changes by: 2318 // Reduce jankiness during the following position changes by:
2315 // * Hiding the window until it's in the final position 2319 // * Hiding the window until it's in the final position
2316 // * Ignoring all intervening Layout() calls, which resize the webpage and 2320 // * Ignoring all intervening Layout() calls, which resize the webpage and
2317 // thus are slow and look ugly 2321 // thus are slow and look ugly
2318 ignore_layout_ = true; 2322 ignore_layout_ = true;
2319 LocationBarView* location_bar = GetLocationBarView(); 2323 LocationBarView* location_bar = GetLocationBarView();
2320 #if defined(OS_WIN) 2324 #if defined(OS_WIN) && !defined(USE_AURA)
2321 OmniboxViewWin* omnibox_view = 2325 OmniboxViewWin* omnibox_view =
2322 static_cast<OmniboxViewWin*>(location_bar->location_entry()); 2326 static_cast<OmniboxViewWin*>(location_bar->location_entry());
2323 #endif 2327 #endif
2324 if (!fullscreen) { 2328 if (!fullscreen) {
2325 // Hide the fullscreen bubble as soon as possible, since the mode toggle can 2329 // Hide the fullscreen bubble as soon as possible, since the mode toggle can
2326 // take enough time for the user to notice. 2330 // take enough time for the user to notice.
2327 fullscreen_bubble_.reset(); 2331 fullscreen_bubble_.reset();
2328 } else { 2332 } else {
2329 // Move focus out of the location bar if necessary. 2333 // Move focus out of the location bar if necessary.
2330 views::FocusManager* focus_manager = GetFocusManager(); 2334 views::FocusManager* focus_manager = GetFocusManager();
2331 DCHECK(focus_manager); 2335 DCHECK(focus_manager);
2332 if (focus_manager->GetFocusedView() == location_bar) 2336 if (focus_manager->GetFocusedView() == location_bar)
2333 focus_manager->ClearFocus(); 2337 focus_manager->ClearFocus();
2334 2338
2335 #if defined(OS_WIN) 2339 #if defined(OS_WIN) && !defined(USE_AURA)
2336 // If we don't hide the edit and force it to not show until we come out of 2340 // If we don't hide the edit and force it to not show until we come out of
2337 // fullscreen, then if the user was on the New Tab Page, the edit contents 2341 // fullscreen, then if the user was on the New Tab Page, the edit contents
2338 // will appear atop the web contents once we go into fullscreen mode. This 2342 // will appear atop the web contents once we go into fullscreen mode. This
2339 // has something to do with how we move the main window while it's hidden; 2343 // has something to do with how we move the main window while it's hidden;
2340 // if we don't hide the main window below, we don't get this problem. 2344 // if we don't hide the main window below, we don't get this problem.
2341 omnibox_view->set_force_hidden(true); 2345 omnibox_view->set_force_hidden(true);
2342 ShowWindow(omnibox_view->m_hWnd, SW_HIDE); 2346 ShowWindow(omnibox_view->m_hWnd, SW_HIDE);
2343 #endif 2347 #endif
2344 } 2348 }
2345 #if defined(OS_WIN) 2349 #if defined(OS_WIN) && !defined(USE_AURA)
2346 static_cast<views::NativeWidgetWin*>(frame_->native_widget())-> 2350 static_cast<views::NativeWidgetWin*>(frame_->native_widget())->
2347 PushForceHidden(); 2351 PushForceHidden();
2348 #endif 2352 #endif
2349 2353
2350 // Toggle fullscreen mode. 2354 // Toggle fullscreen mode.
2351 #if defined(OS_WIN) 2355 #if defined(OS_WIN) && !defined(USE_AURA)
2352 frame_->SetFullscreen(fullscreen); 2356 frame_->SetFullscreen(fullscreen);
2353 #endif // No need to invoke SetFullscreen for linux as this code is executed 2357 #endif // No need to invoke SetFullscreen for linux as this code is executed
2354 // once we're already fullscreen on linux. 2358 // once we're already fullscreen on linux.
2355 2359
2356 browser_->WindowFullscreenStateChanged(); 2360 browser_->WindowFullscreenStateChanged();
2357 2361
2358 if (fullscreen) { 2362 if (fullscreen) {
2359 bool is_kiosk = 2363 bool is_kiosk =
2360 CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); 2364 CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode);
2361 if (!is_kiosk) { 2365 if (!is_kiosk) {
2362 fullscreen_bubble_.reset(new FullscreenExitBubbleViews(GetWidget(), 2366 fullscreen_bubble_.reset(new FullscreenExitBubbleViews(GetWidget(),
2363 browser_.get())); 2367 browser_.get()));
2364 } 2368 }
2365 } else { 2369 } else {
2366 #if defined(OS_WIN) 2370 #if defined(OS_WIN) && !defined(USE_AURA)
2367 // Show the edit again since we're no longer in fullscreen mode. 2371 // Show the edit again since we're no longer in fullscreen mode.
2368 omnibox_view->set_force_hidden(false); 2372 omnibox_view->set_force_hidden(false);
2369 ShowWindow(omnibox_view->m_hWnd, SW_SHOW); 2373 ShowWindow(omnibox_view->m_hWnd, SW_SHOW);
2370 #endif 2374 #endif
2371 } 2375 }
2372 2376
2373 // Undo our anti-jankiness hacks and force the window to re-layout now that 2377 // Undo our anti-jankiness hacks and force the window to re-layout now that
2374 // it's in its final position. 2378 // it's in its final position.
2375 ignore_layout_ = false; 2379 ignore_layout_ = false;
2376 Layout(); 2380 Layout();
2377 #if defined(OS_WIN) 2381 #if defined(OS_WIN) && !defined(USE_AURA)
2378 static_cast<views::NativeWidgetWin*>(frame_->native_widget())-> 2382 static_cast<views::NativeWidgetWin*>(frame_->native_widget())->
2379 PopForceHidden(); 2383 PopForceHidden();
2380 #endif 2384 #endif
2381 } 2385 }
2382 2386
2383 2387
2384 void BrowserView::LoadAccelerators() { 2388 void BrowserView::LoadAccelerators() {
2385 #if defined(OS_WIN) 2389 #if defined(USE_AURA)
2390 // TODO(beng):
2391 NOTIMPLEMENTED();
2392 #elif defined(OS_WIN)
2386 HACCEL accelerator_table = AtlLoadAccelerators(IDR_MAINFRAME); 2393 HACCEL accelerator_table = AtlLoadAccelerators(IDR_MAINFRAME);
2387 DCHECK(accelerator_table); 2394 DCHECK(accelerator_table);
2388 2395
2389 // We have to copy the table to access its contents. 2396 // We have to copy the table to access its contents.
2390 int count = CopyAcceleratorTable(accelerator_table, 0, 0); 2397 int count = CopyAcceleratorTable(accelerator_table, 0, 0);
2391 if (count == 0) { 2398 if (count == 0) {
2392 // Nothing to do in that case. 2399 // Nothing to do in that case.
2393 return; 2400 return;
2394 } 2401 }
2395 2402
(...skipping 29 matching lines...) Expand all
2425 browser::kAcceleratorMap[i].ctrl_pressed, 2432 browser::kAcceleratorMap[i].ctrl_pressed,
2426 browser::kAcceleratorMap[i].alt_pressed); 2433 browser::kAcceleratorMap[i].alt_pressed);
2427 accelerator_table_[accelerator] = browser::kAcceleratorMap[i].command_id; 2434 accelerator_table_[accelerator] = browser::kAcceleratorMap[i].command_id;
2428 2435
2429 // Also register with the focus manager. 2436 // Also register with the focus manager.
2430 focus_manager->RegisterAccelerator(accelerator, this); 2437 focus_manager->RegisterAccelerator(accelerator, this);
2431 } 2438 }
2432 #endif 2439 #endif
2433 } 2440 }
2434 2441
2435 #if defined(OS_WIN) 2442 #if defined(OS_WIN) && !defined(USE_AURA)
2436 void BrowserView::BuildSystemMenuForBrowserWindow() { 2443 void BrowserView::BuildSystemMenuForBrowserWindow() {
2437 system_menu_contents_->AddSeparator(); 2444 system_menu_contents_->AddSeparator();
2438 system_menu_contents_->AddItemWithStringId(IDC_TASK_MANAGER, 2445 system_menu_contents_->AddItemWithStringId(IDC_TASK_MANAGER,
2439 IDS_TASK_MANAGER); 2446 IDS_TASK_MANAGER);
2440 system_menu_contents_->AddSeparator(); 2447 system_menu_contents_->AddSeparator();
2441 system_menu_contents_->AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); 2448 system_menu_contents_->AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB);
2442 system_menu_contents_->AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB); 2449 system_menu_contents_->AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB);
2443 AddFrameToggleItems(); 2450 AddFrameToggleItems();
2444 // If it's a regular browser window with tabs, we don't add any more items, 2451 // If it's a regular browser window with tabs, we don't add any more items,
2445 // since it already has menus (Page, Chrome). 2452 // since it already has menus (Page, Chrome).
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2488 if (CommandLine::ForCurrentProcess()->HasSwitch( 2495 if (CommandLine::ForCurrentProcess()->HasSwitch(
2489 switches::kDebugEnableFrameToggle)) { 2496 switches::kDebugEnableFrameToggle)) {
2490 system_menu_contents_->AddSeparator(); 2497 system_menu_contents_->AddSeparator();
2491 system_menu_contents_->AddItem(IDC_DEBUG_FRAME_TOGGLE, 2498 system_menu_contents_->AddItem(IDC_DEBUG_FRAME_TOGGLE,
2492 L"Toggle Frame Type"); 2499 L"Toggle Frame Type");
2493 } 2500 }
2494 } 2501 }
2495 #endif 2502 #endif
2496 2503
2497 int BrowserView::GetCommandIDForAppCommandID(int app_command_id) const { 2504 int BrowserView::GetCommandIDForAppCommandID(int app_command_id) const {
2498 #if defined(OS_WIN) 2505 #if defined(OS_WIN) && !defined(USE_AURA)
2499 switch (app_command_id) { 2506 switch (app_command_id) {
2500 // NOTE: The order here matches the APPCOMMAND declaration order in the 2507 // NOTE: The order here matches the APPCOMMAND declaration order in the
2501 // Windows headers. 2508 // Windows headers.
2502 case APPCOMMAND_BROWSER_BACKWARD: return IDC_BACK; 2509 case APPCOMMAND_BROWSER_BACKWARD: return IDC_BACK;
2503 case APPCOMMAND_BROWSER_FORWARD: return IDC_FORWARD; 2510 case APPCOMMAND_BROWSER_FORWARD: return IDC_FORWARD;
2504 case APPCOMMAND_BROWSER_REFRESH: return IDC_RELOAD; 2511 case APPCOMMAND_BROWSER_REFRESH: return IDC_RELOAD;
2505 case APPCOMMAND_BROWSER_HOME: return IDC_HOME; 2512 case APPCOMMAND_BROWSER_HOME: return IDC_HOME;
2506 case APPCOMMAND_BROWSER_STOP: return IDC_STOP; 2513 case APPCOMMAND_BROWSER_STOP: return IDC_STOP;
2507 case APPCOMMAND_BROWSER_SEARCH: return IDC_FOCUS_SEARCH; 2514 case APPCOMMAND_BROWSER_SEARCH: return IDC_FOCUS_SEARCH;
2508 case APPCOMMAND_HELP: return IDC_HELP_PAGE; 2515 case APPCOMMAND_HELP: return IDC_HELP_PAGE;
(...skipping 12 matching lines...) Expand all
2521 case APPCOMMAND_SPELL_CHECK: 2528 case APPCOMMAND_SPELL_CHECK:
2522 default: return -1; 2529 default: return -1;
2523 } 2530 }
2524 #else 2531 #else
2525 // App commands are Windows-specific so there's nothing to do here. 2532 // App commands are Windows-specific so there's nothing to do here.
2526 return -1; 2533 return -1;
2527 #endif 2534 #endif
2528 } 2535 }
2529 2536
2530 void BrowserView::InitHangMonitor() { 2537 void BrowserView::InitHangMonitor() {
2531 #if defined(OS_WIN) 2538 #if defined(OS_WIN) && !defined(USE_AURA)
2532 PrefService* pref_service = g_browser_process->local_state(); 2539 PrefService* pref_service = g_browser_process->local_state();
2533 if (!pref_service) 2540 if (!pref_service)
2534 return; 2541 return;
2535 2542
2536 int plugin_message_response_timeout = 2543 int plugin_message_response_timeout =
2537 pref_service->GetInteger(prefs::kPluginMessageResponseTimeout); 2544 pref_service->GetInteger(prefs::kPluginMessageResponseTimeout);
2538 int hung_plugin_detect_freq = 2545 int hung_plugin_detect_freq =
2539 pref_service->GetInteger(prefs::kHungPluginDetectFrequency); 2546 pref_service->GetInteger(prefs::kHungPluginDetectFrequency);
2540 if ((hung_plugin_detect_freq > 0) && 2547 if ((hung_plugin_detect_freq > 0) &&
2541 hung_window_detector_.Initialize(GetWidget()->GetNativeView(), 2548 hung_window_detector_.Initialize(GetWidget()->GetNativeView(),
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 2681 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
2675 // Create the view and the frame. The frame will attach itself via the view 2682 // Create the view and the frame. The frame will attach itself via the view
2676 // so we don't need to do anything with the pointer. 2683 // so we don't need to do anything with the pointer.
2677 BrowserView* view = new BrowserView(browser); 2684 BrowserView* view = new BrowserView(browser);
2678 (new BrowserFrame(view))->InitBrowserFrame(); 2685 (new BrowserFrame(view))->InitBrowserFrame();
2679 view->GetWidget()->non_client_view()->SetAccessibleName( 2686 view->GetWidget()->non_client_view()->SetAccessibleName(
2680 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 2687 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
2681 return view; 2688 return view;
2682 } 2689 }
2683 #endif 2690 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/browser/ui/views/infobars/infobar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698