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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 #include "views/events/event.h" | 98 #include "views/events/event.h" |
99 #include "views/focus/external_focus_tracker.h" | 99 #include "views/focus/external_focus_tracker.h" |
100 #include "views/focus/view_storage.h" | 100 #include "views/focus/view_storage.h" |
101 #include "views/layout/grid_layout.h" | 101 #include "views/layout/grid_layout.h" |
102 #include "views/widget/native_widget.h" | 102 #include "views/widget/native_widget.h" |
103 #include "views/widget/root_view.h" | 103 #include "views/widget/root_view.h" |
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/aura/launcher_icon_updater.h" |
| 109 #include "ui/aura_shell/launcher/launcher.h" |
| 110 #include "ui/aura_shell/launcher/launcher_model.h" |
| 111 #include "ui/aura_shell/shell.h" |
| 112 #include "ui/base/view_prop.h" |
108 #elif defined(OS_WIN) | 113 #elif defined(OS_WIN) |
109 #include "chrome/browser/aeropeek_manager.h" | 114 #include "chrome/browser/aeropeek_manager.h" |
110 #include "chrome/browser/jumplist_win.h" | 115 #include "chrome/browser/jumplist_win.h" |
111 #include "ui/base/message_box_win.h" | 116 #include "ui/base/message_box_win.h" |
112 #include "ui/base/view_prop.h" | |
113 #include "views/widget/native_widget_win.h" | 117 #include "views/widget/native_widget_win.h" |
114 #elif defined(TOOLKIT_USES_GTK) | 118 #elif defined(TOOLKIT_USES_GTK) |
115 #include "chrome/browser/ui/views/accelerator_table_linux.h" | 119 #include "chrome/browser/ui/views/accelerator_table_linux.h" |
116 #include "views/window/hit_test.h" | 120 #include "views/window/hit_test.h" |
117 #if !defined(TOUCH_UI) | 121 #if !defined(TOUCH_UI) |
118 #include "chrome/browser/ui/views/handle_web_keyboard_event.h" | 122 #include "chrome/browser/ui/views/handle_web_keyboard_event.h" |
119 #endif | 123 #endif |
120 #endif | 124 #endif |
121 | 125 |
122 #if defined(OS_CHROMEOS) | 126 #if defined(OS_CHROMEOS) |
123 #include "chrome/browser/ui/views/keyboard_overlay_dialog_view.h" | 127 #include "chrome/browser/ui/views/keyboard_overlay_dialog_view.h" |
124 #else | 128 #else |
125 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 129 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
126 #endif | 130 #endif |
127 | 131 |
| 132 #if defined(OS_WIN) && !defined(USE_AURA) |
| 133 #include "ui/base/view_prop.h" |
| 134 #endif |
| 135 |
128 #if defined(TOUCH_UI) | 136 #if defined(TOUCH_UI) |
129 #include "chrome/browser/ui/touch/status_bubble_touch.h" | 137 #include "chrome/browser/ui/touch/status_bubble_touch.h" |
130 #endif | 138 #endif |
131 | 139 |
132 using base::TimeDelta; | 140 using base::TimeDelta; |
133 using views::ColumnSet; | 141 using views::ColumnSet; |
134 using views::GridLayout; | 142 using views::GridLayout; |
135 | 143 |
136 // The height of the status bubble. | 144 // The height of the status bubble. |
137 static const int kStatusBubbleHeight = 20; | 145 static const int kStatusBubbleHeight = 20; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 delete tabstrip_; | 367 delete tabstrip_; |
360 tabstrip_ = NULL; | 368 tabstrip_ = NULL; |
361 } | 369 } |
362 // Child views maintain PrefMember attributes that point to | 370 // Child views maintain PrefMember attributes that point to |
363 // OffTheRecordProfile's PrefService which gets deleted by ~Browser. | 371 // OffTheRecordProfile's PrefService which gets deleted by ~Browser. |
364 RemoveAllChildViews(true); | 372 RemoveAllChildViews(true); |
365 // Explicitly set browser_ to NULL. | 373 // Explicitly set browser_ to NULL. |
366 browser_.reset(); | 374 browser_.reset(); |
367 } | 375 } |
368 | 376 |
369 // Tab dragging code on windows needs this. | 377 #if defined(OS_WIN) || defined(USE_AURA) |
370 #if defined(OS_WIN) && !defined(USE_AURA) | |
371 // static | 378 // static |
372 BrowserView* BrowserView::GetBrowserViewForNativeWindow( | 379 BrowserView* BrowserView::GetBrowserViewForNativeWindow( |
373 gfx::NativeWindow window) { | 380 gfx::NativeWindow window) { |
374 return IsWindow(window) ? reinterpret_cast<BrowserView*>( | 381 return reinterpret_cast<BrowserView*>( |
375 ui::ViewProp::GetValue(window, kBrowserViewKey)) : NULL; | 382 ui::ViewProp::GetValue(window, kBrowserViewKey)); |
376 } | 383 } |
377 #endif | 384 #endif |
378 | 385 |
379 // static | 386 // static |
380 BrowserView* BrowserView::GetBrowserViewForBrowser(Browser* browser) { | 387 BrowserView* BrowserView::GetBrowserViewForBrowser(Browser* browser) { |
381 return static_cast<BrowserView*>(browser->window()); | 388 return static_cast<BrowserView*>(browser->window()); |
382 } | 389 } |
383 | 390 |
384 gfx::Rect BrowserView::GetToolbarBounds() const { | 391 gfx::Rect BrowserView::GetToolbarBounds() const { |
385 gfx::Rect toolbar_bounds(toolbar_->bounds()); | 392 gfx::Rect toolbar_bounds(toolbar_->bounds()); |
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1900 | 1907 |
1901 if (AeroPeekManager::Enabled()) { | 1908 if (AeroPeekManager::Enabled()) { |
1902 aeropeek_manager_.reset(new AeroPeekManager( | 1909 aeropeek_manager_.reset(new AeroPeekManager( |
1903 frame_->GetNativeWindow())); | 1910 frame_->GetNativeWindow())); |
1904 browser_->tabstrip_model()->AddObserver(aeropeek_manager_.get()); | 1911 browser_->tabstrip_model()->AddObserver(aeropeek_manager_.get()); |
1905 } | 1912 } |
1906 #endif | 1913 #endif |
1907 | 1914 |
1908 // We're now initialized and ready to process Layout requests. | 1915 // We're now initialized and ready to process Layout requests. |
1909 ignore_layout_ = false; | 1916 ignore_layout_ = false; |
| 1917 |
| 1918 #if defined(USE_AURA) |
| 1919 icon_updater_.reset(new LauncherIconUpdater( |
| 1920 browser_->tabstrip_model(), |
| 1921 aura_shell::Shell::GetInstance()->launcher()->model(), |
| 1922 frame_->GetNativeWindow())); |
| 1923 #endif |
1910 } | 1924 } |
1911 | 1925 |
1912 void BrowserView::LoadingAnimationCallback() { | 1926 void BrowserView::LoadingAnimationCallback() { |
1913 base::TimeTicks now = base::TimeTicks::Now(); | 1927 base::TimeTicks now = base::TimeTicks::Now(); |
1914 if (!last_animation_time_.is_null()) { | 1928 if (!last_animation_time_.is_null()) { |
1915 UMA_HISTOGRAM_TIMES( | 1929 UMA_HISTOGRAM_TIMES( |
1916 "Tabs.LoadingAnimationTime", | 1930 "Tabs.LoadingAnimationTime", |
1917 now - last_animation_time_); | 1931 now - last_animation_time_); |
1918 } | 1932 } |
1919 last_animation_time_ = now; | 1933 last_animation_time_ = now; |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); | 2569 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); |
2556 gfx::Rect bounds; | 2570 gfx::Rect bounds; |
2557 bounds.set_origin(origin); | 2571 bounds.set_origin(origin); |
2558 | 2572 |
2559 AvatarMenuBubbleView* bubble_view = new AvatarMenuBubbleView(browser_.get()); | 2573 AvatarMenuBubbleView* bubble_view = new AvatarMenuBubbleView(browser_.get()); |
2560 // Bubble::Show() takes ownership of the view. | 2574 // Bubble::Show() takes ownership of the view. |
2561 Bubble::Show(this->GetWidget(), bounds, | 2575 Bubble::Show(this->GetWidget(), bounds, |
2562 views::BubbleBorder::TOP_RIGHT, | 2576 views::BubbleBorder::TOP_RIGHT, |
2563 bubble_view, bubble_view); | 2577 bubble_view, bubble_view); |
2564 } | 2578 } |
OLD | NEW |