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(OS_LINUX) | 7 #if defined(OS_LINUX) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 #include "chrome/browser/ui/views/fullscreen_exit_bubble.h" | 52 #include "chrome/browser/ui/views/fullscreen_exit_bubble.h" |
| 53 #include "chrome/browser/ui/views/status_bubble_views.h" | 53 #include "chrome/browser/ui/views/status_bubble_views.h" |
| 54 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" | 54 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" |
| 55 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 55 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
| 56 #include "chrome/browser/ui/views/tabs/tab_strip_factory.h" | 56 #include "chrome/browser/ui/views/tabs/tab_strip_factory.h" |
| 57 #include "chrome/browser/ui/views/theme_install_bubble_view.h" | 57 #include "chrome/browser/ui/views/theme_install_bubble_view.h" |
| 58 #include "chrome/browser/ui/views/toolbar_view.h" | 58 #include "chrome/browser/ui/views/toolbar_view.h" |
| 59 #include "chrome/browser/ui/views/update_recommended_message_box.h" | 59 #include "chrome/browser/ui/views/update_recommended_message_box.h" |
| 60 #include "chrome/browser/ui/views/window.h" | 60 #include "chrome/browser/ui/views/window.h" |
| 61 #include "chrome/browser/ui/window_sizer.h" | 61 #include "chrome/browser/ui/window_sizer.h" |
| 62 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" | |
| 62 #include "chrome/common/chrome_switches.h" | 63 #include "chrome/common/chrome_switches.h" |
| 63 #include "chrome/common/extensions/extension_resource.h" | 64 #include "chrome/common/extensions/extension_resource.h" |
| 64 #include "chrome/common/native_window_notification_source.h" | 65 #include "chrome/common/native_window_notification_source.h" |
| 65 #include "chrome/common/notification_service.h" | 66 #include "chrome/common/notification_service.h" |
| 66 #include "chrome/common/pref_names.h" | 67 #include "chrome/common/pref_names.h" |
| 67 #include "chrome/common/url_constants.h" | 68 #include "chrome/common/url_constants.h" |
| 68 #include "gfx/canvas_skia.h" | 69 #include "gfx/canvas_skia.h" |
| 69 #include "grit/app_resources.h" | 70 #include "grit/app_resources.h" |
| 70 #include "grit/chromium_strings.h" | 71 #include "grit/chromium_strings.h" |
| 71 #include "grit/generated_resources.h" | 72 #include "grit/generated_resources.h" |
| 72 #include "grit/locale_settings.h" | 73 #include "grit/locale_settings.h" |
| 73 #include "grit/theme_resources.h" | 74 #include "grit/theme_resources.h" |
| 74 #include "grit/webkit_resources.h" | 75 #include "grit/webkit_resources.h" |
| 75 #include "ui/base/l10n/l10n_util.h" | 76 #include "ui/base/l10n/l10n_util.h" |
| 76 #include "ui/base/resource/resource_bundle.h" | 77 #include "ui/base/resource/resource_bundle.h" |
| 77 #include "views/controls/single_split_view.h" | 78 #include "views/controls/single_split_view.h" |
| 78 #include "views/focus/external_focus_tracker.h" | 79 #include "views/focus/external_focus_tracker.h" |
| 79 #include "views/focus/view_storage.h" | 80 #include "views/focus/view_storage.h" |
| 80 #include "views/layout/grid_layout.h" | 81 #include "views/layout/grid_layout.h" |
| 81 #include "views/widget/root_view.h" | 82 #include "views/widget/root_view.h" |
| 82 #include "views/window/dialog_delegate.h" | 83 #include "views/window/dialog_delegate.h" |
| 83 #include "views/window/window.h" | 84 #include "views/window/window.h" |
| 84 | 85 |
| 85 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
| 86 #include "app/win/win_util.h" | |
| 87 #include "chrome/browser/aeropeek_manager.h" | 87 #include "chrome/browser/aeropeek_manager.h" |
| 88 #include "chrome/browser/jumplist_win.h" | 88 #include "chrome/browser/jumplist_win.h" |
| 89 #include "ui/base/view_prop.h" | 89 #include "ui/base/view_prop.h" |
| 90 #include "ui/base/message_box_win.h" | |
| 90 #elif defined(OS_LINUX) | 91 #elif defined(OS_LINUX) |
| 91 #include "chrome/browser/ui/views/accelerator_table_gtk.h" | 92 #include "chrome/browser/ui/views/accelerator_table_gtk.h" |
| 92 #include "views/window/hit_test.h" | 93 #include "views/window/hit_test.h" |
| 93 #include "views/window/window_gtk.h" | 94 #include "views/window/window_gtk.h" |
| 94 #endif | 95 #endif |
| 95 | 96 |
| 96 #if defined(OS_CHROMEOS) | 97 #if defined(OS_CHROMEOS) |
| 97 #include "chrome/browser/ui/views/keyboard_overlay_delegate.h" | 98 #include "chrome/browser/ui/views/keyboard_overlay_delegate.h" |
| 98 #endif | 99 #endif |
| 99 | 100 |
| (...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1135 } | 1136 } |
| 1136 | 1137 |
| 1137 void BrowserView::ShowCollectedCookiesDialog(TabContents* tab_contents) { | 1138 void BrowserView::ShowCollectedCookiesDialog(TabContents* tab_contents) { |
| 1138 browser::ShowCollectedCookiesDialog(GetNativeHandle(), tab_contents); | 1139 browser::ShowCollectedCookiesDialog(GetNativeHandle(), tab_contents); |
| 1139 } | 1140 } |
| 1140 | 1141 |
| 1141 void BrowserView::ShowProfileErrorDialog(int message_id) { | 1142 void BrowserView::ShowProfileErrorDialog(int message_id) { |
| 1142 #if defined(OS_WIN) | 1143 #if defined(OS_WIN) |
| 1143 string16 title = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 1144 string16 title = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
| 1144 string16 message = l10n_util::GetStringUTF16(message_id); | 1145 string16 message = l10n_util::GetStringUTF16(message_id); |
| 1145 app::win::MessageBox(GetNativeHandle(), message, title, | 1146 ui::MessageBox(GetNativeHandle(), message, title, |
| 1146 MB_OK | MB_ICONWARNING | MB_TOPMOST); | 1147 MB_OK | MB_ICONWARNING | MB_TOPMOST); |
|
Ben Goodger (Google)
2011/01/27 18:44:22
Can this whole function be rewritten to use platfo
msw
2011/02/01 23:12:56
It's not a perfect match. I'll tweak this & other
| |
| 1147 #elif defined(OS_LINUX) | 1148 #elif defined(OS_LINUX) |
| 1148 std::string title = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); | 1149 std::string title = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); |
| 1149 std::string message = l10n_util::GetStringUTF8(message_id); | 1150 std::string message = l10n_util::GetStringUTF8(message_id); |
| 1150 GtkWidget* dialog = gtk_message_dialog_new(GetNativeHandle(), | 1151 GtkWidget* dialog = gtk_message_dialog_new(GetNativeHandle(), |
| 1151 static_cast<GtkDialogFlags>(0), GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, | 1152 static_cast<GtkDialogFlags>(0), GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, |
| 1152 "%s", message.c_str()); | 1153 "%s", message.c_str()); |
| 1153 gtk_window_set_title(GTK_WINDOW(dialog), title.c_str()); | 1154 gtk_window_set_title(GTK_WINDOW(dialog), title.c_str()); |
| 1154 g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); | 1155 g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); |
| 1155 gtk_widget_show_all(dialog); | 1156 gtk_widget_show_all(dialog); |
| 1156 #else | 1157 #else |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1393 preview_container_ = NULL; | 1394 preview_container_ = NULL; |
| 1394 } | 1395 } |
| 1395 | 1396 |
| 1396 gfx::Rect BrowserView::GetInstantBounds() { | 1397 gfx::Rect BrowserView::GetInstantBounds() { |
| 1397 return contents_->GetPreviewBounds(); | 1398 return contents_->GetPreviewBounds(); |
| 1398 } | 1399 } |
| 1399 | 1400 |
| 1400 gfx::Rect BrowserView::GrabWindowSnapshot(std::vector<unsigned char>* | 1401 gfx::Rect BrowserView::GrabWindowSnapshot(std::vector<unsigned char>* |
| 1401 png_representation) { | 1402 png_representation) { |
| 1402 views::Window* window = GetWindow(); | 1403 views::Window* window = GetWindow(); |
| 1403 | 1404 gfx::NativeWindow native_window= window->GetNativeWindow(); |
|
Ben Goodger (Google)
2011/01/27 18:44:22
space before =
msw
2011/02/01 23:12:56
Not applicable in updated CL.
How did static analy
| |
| 1404 #if defined(USE_X11) | 1405 browser::GrabWindowSnapshot(native_window, png_representation); |
|
Ben Goodger (Google)
2011/01/27 18:44:22
Does anyone actually call this method? I don't thi
msw
2011/02/01 23:12:56
Good point; the updated CL consolidates a lot of G
| |
| 1405 ui::GrabWindowSnapshot(window->GetNativeWindow(), png_representation); | |
| 1406 #elif defined(OS_WIN) | |
| 1407 app::win::GrabWindowSnapshot(window->GetNativeWindow(), png_representation); | |
| 1408 #endif | |
| 1409 | 1406 |
| 1410 return window->GetBounds(); | 1407 return window->GetBounds(); |
| 1411 } | 1408 } |
| 1412 | 1409 |
| 1413 #if defined(OS_CHROMEOS) | 1410 #if defined(OS_CHROMEOS) |
| 1414 void BrowserView::ShowKeyboardOverlay(gfx::NativeWindow owning_window) { | 1411 void BrowserView::ShowKeyboardOverlay(gfx::NativeWindow owning_window) { |
| 1415 KeyboardOverlayDelegate::ShowDialog(owning_window); | 1412 KeyboardOverlayDelegate::ShowDialog(owning_window); |
| 1416 } | 1413 } |
| 1417 #endif | 1414 #endif |
| 1418 | 1415 |
| (...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2564 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 2561 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 2565 | 2562 |
| 2566 return view; | 2563 return view; |
| 2567 } | 2564 } |
| 2568 #endif | 2565 #endif |
| 2569 | 2566 |
| 2570 // static | 2567 // static |
| 2571 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { | 2568 FindBar* BrowserWindow::CreateFindBar(Browser* browser) { |
| 2572 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); | 2569 return browser::CreateFindBar(static_cast<BrowserView*>(browser->window())); |
| 2573 } | 2570 } |
| OLD | NEW |