Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 #include "views/widget/widget.h" | 104 #include "views/widget/widget.h" |
| 105 #include "views/window/dialog_delegate.h" | 105 #include "views/window/dialog_delegate.h" |
| 106 | 106 |
| 107 #if defined(USE_AURA) | 107 #if defined(USE_AURA) |
| 108 #include "chrome/browser/ui/views/accelerator_table.h" | 108 #include "chrome/browser/ui/views/accelerator_table.h" |
| 109 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" | 109 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" |
| 110 #include "chrome/browser/ui/views/aura/launcher_icon_updater.h" | 110 #include "chrome/browser/ui/views/aura/launcher_icon_updater.h" |
| 111 #include "ui/aura_shell/launcher/launcher.h" | 111 #include "ui/aura_shell/launcher/launcher.h" |
| 112 #include "ui/aura_shell/launcher/launcher_model.h" | 112 #include "ui/aura_shell/launcher/launcher_model.h" |
| 113 #include "ui/aura_shell/shell.h" | 113 #include "ui/aura_shell/shell.h" |
| 114 #include "ui/base/view_prop.h" | |
| 115 #elif defined(OS_WIN) | 114 #elif defined(OS_WIN) |
| 116 #include "chrome/browser/aeropeek_manager.h" | 115 #include "chrome/browser/aeropeek_manager.h" |
| 117 #include "chrome/browser/jumplist_win.h" | 116 #include "chrome/browser/jumplist_win.h" |
| 118 #include "ui/base/message_box_win.h" | 117 #include "ui/base/message_box_win.h" |
| 119 #include "views/widget/native_widget_win.h" | 118 #include "views/widget/native_widget_win.h" |
| 120 #elif defined(TOOLKIT_USES_GTK) | 119 #elif defined(TOOLKIT_USES_GTK) |
| 121 #include "chrome/browser/ui/views/accelerator_table.h" | 120 #include "chrome/browser/ui/views/accelerator_table.h" |
| 122 #include "views/window/hit_test.h" | 121 #include "views/window/hit_test.h" |
| 123 #if !defined(TOUCH_UI) | 122 #if !defined(TOUCH_UI) |
| 124 #include "chrome/browser/ui/views/handle_web_keyboard_event.h" | 123 #include "chrome/browser/ui/views/handle_web_keyboard_event.h" |
| 125 #endif | 124 #endif |
| 126 #endif | 125 #endif |
| 127 | 126 |
| 128 #if defined(OS_CHROMEOS) | 127 #if defined(OS_CHROMEOS) |
| 129 #include "chrome/browser/ui/views/keyboard_overlay_dialog_view.h" | 128 #include "chrome/browser/ui/views/keyboard_overlay_dialog_view.h" |
| 130 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" | 129 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
| 131 #else | 130 #else |
| 132 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 131 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
| 133 #endif | 132 #endif |
| 134 | 133 |
| 135 #if defined(OS_WIN) && !defined(USE_AURA) | |
| 136 #include "ui/base/view_prop.h" | |
| 137 #endif | |
| 138 | |
| 139 #if defined(TOUCH_UI) | 134 #if defined(TOUCH_UI) |
| 140 #include "chrome/browser/ui/touch/status_bubble_touch.h" | 135 #include "chrome/browser/ui/touch/status_bubble_touch.h" |
| 141 #endif | 136 #endif |
| 142 | 137 |
| 143 using base::TimeDelta; | 138 using base::TimeDelta; |
| 144 using views::ColumnSet; | 139 using views::ColumnSet; |
| 145 using views::GridLayout; | 140 using views::GridLayout; |
| 146 | 141 |
| 147 // The height of the status bubble. | 142 // The height of the status bubble. |
| 148 static const int kStatusBubbleHeight = 20; | 143 static const int kStatusBubbleHeight = 20; |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 // OffTheRecordProfile's PrefService which gets deleted by ~Browser. | 370 // OffTheRecordProfile's PrefService which gets deleted by ~Browser. |
| 376 RemoveAllChildViews(true); | 371 RemoveAllChildViews(true); |
| 377 // Explicitly set browser_ to NULL. | 372 // Explicitly set browser_ to NULL. |
| 378 browser_.reset(); | 373 browser_.reset(); |
| 379 } | 374 } |
| 380 | 375 |
| 381 #if defined(OS_WIN) || defined(USE_AURA) | 376 #if defined(OS_WIN) || defined(USE_AURA) |
| 382 // static | 377 // static |
| 383 BrowserView* BrowserView::GetBrowserViewForNativeWindow( | 378 BrowserView* BrowserView::GetBrowserViewForNativeWindow( |
| 384 gfx::NativeWindow window) { | 379 gfx::NativeWindow window) { |
| 380 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); | |
|
sky
2011/11/01 14:54:40
It's entirely possible widget is NULL here.
oshima
2011/11/01 15:36:56
Done.
| |
| 381 DCHECK(widget); | |
| 385 return reinterpret_cast<BrowserView*>( | 382 return reinterpret_cast<BrowserView*>( |
| 386 ui::ViewProp::GetValue(window, kBrowserViewKey)); | 383 widget->GetNativeWindowProperty(kBrowserViewKey)); |
| 387 } | 384 } |
| 388 #endif | 385 #endif |
| 389 | 386 |
| 390 // static | 387 // static |
| 391 BrowserView* BrowserView::GetBrowserViewForBrowser(Browser* browser) { | 388 BrowserView* BrowserView::GetBrowserViewForBrowser(Browser* browser) { |
| 392 return static_cast<BrowserView*>(browser->window()); | 389 return static_cast<BrowserView*>(browser->window()); |
| 393 } | 390 } |
| 394 | 391 |
| 395 gfx::Rect BrowserView::GetToolbarBounds() const { | 392 gfx::Rect BrowserView::GetToolbarBounds() const { |
| 396 gfx::Rect toolbar_bounds(toolbar_->bounds()); | 393 gfx::Rect toolbar_bounds(toolbar_->bounds()); |
| (...skipping 2217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2614 Bubble::Show(this->GetWidget(), bounds, | 2611 Bubble::Show(this->GetWidget(), bounds, |
| 2615 views::BubbleBorder::TOP_RIGHT, | 2612 views::BubbleBorder::TOP_RIGHT, |
| 2616 bubble_view, bubble_view); | 2613 bubble_view, bubble_view); |
| 2617 } | 2614 } |
| 2618 | 2615 |
| 2619 void BrowserView::ShowAvatarBubbleFromAvatarButton() { | 2616 void BrowserView::ShowAvatarBubbleFromAvatarButton() { |
| 2620 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); | 2617 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); |
| 2621 if (button) | 2618 if (button) |
| 2622 button->ShowAvatarBubble(); | 2619 button->ShowAvatarBubble(); |
| 2623 } | 2620 } |
| OLD | NEW |