diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-29 15:49:57 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-29 15:49:57 +0000 |
commit | 0519e110045415c8d674a8a5d0cdd587b9ce8e1f (patch) | |
tree | 694e989b739f39c086dbc62bdf276d9c92f10aa7 | |
parent | eae033a397da42c049575245c276a6eb6f5be93e (diff) | |
download | chromium_src-0519e110045415c8d674a8a5d0cdd587b9ce8e1f.zip chromium_src-0519e110045415c8d674a8a5d0cdd587b9ce8e1f.tar.gz chromium_src-0519e110045415c8d674a8a5d0cdd587b9ce8e1f.tar.bz2 |
Wires up views on linux dialogs to use gtk ones.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/254007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27484 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser_theme_provider.cc | 2 | ||||
-rw-r--r-- | chrome/browser/browser_theme_provider.h | 6 | ||||
-rw-r--r-- | chrome/browser/defaults.cc | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/bookmark_manager_gtk.cc | 6 | ||||
-rw-r--r-- | chrome/browser/gtk/bookmark_manager_gtk.h | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/gtk_theme_provider.cc | 1 | ||||
-rw-r--r-- | chrome/browser/gtk/options/content_page_gtk.cc | 6 | ||||
-rw-r--r-- | chrome/browser/profile.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/dialog_stubs_gtk.cc | 49 | ||||
-rw-r--r-- | chrome/browser/views/toolbar_view.cc | 4 | ||||
-rw-r--r-- | chrome/chrome.gyp | 24 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.cc | 5 |
12 files changed, 74 insertions, 37 deletions
diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc index e59caf8..53ead1f 100644 --- a/chrome/browser/browser_theme_provider.cc +++ b/chrome/browser/browser_theme_provider.cc @@ -1249,7 +1249,7 @@ void BrowserThemeProvider::ClearCaches() { images_disk_cache_.clear(); } -#if defined(TOOLKIT_VIEWS) +#if defined(OS_WIN) void BrowserThemeProvider::FreePlatformCaches() { // Views (Skia) has no platform image cache to clear. } diff --git a/chrome/browser/browser_theme_provider.h b/chrome/browser/browser_theme_provider.h index cec14d1f..e2059a8 100644 --- a/chrome/browser/browser_theme_provider.h +++ b/chrome/browser/browser_theme_provider.h @@ -161,7 +161,7 @@ class BrowserThemeProvider : public NonThreadSafe, virtual bool ShouldUseNativeFrame(); virtual bool HasCustomImage(int id); virtual bool GetRawData(int id, std::vector<unsigned char>* raw_data); -#if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) +#if defined(OS_LINUX) virtual GdkPixbuf* GetPixbufNamed(int id); virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id); #elif defined(OS_MACOSX) @@ -321,7 +321,7 @@ class BrowserThemeProvider : public NonThreadSafe, // Do we have a custom frame image or custom tints? bool ShouldTintFrames(); -#if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) +#if defined(OS_LINUX) // Loads an image and flips it horizontally if |rtl_enabled| is true. GdkPixbuf* GetPixbufImpl(int id, bool rtl_enabled); #endif @@ -331,7 +331,7 @@ class BrowserThemeProvider : public NonThreadSafe, // using them. typedef std::map<int, SkBitmap*> ImageCache; ImageCache image_cache_; -#if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) +#if defined(OS_LINUX) typedef std::map<int, GdkPixbuf*> GdkPixbufMap; GdkPixbufMap gdk_pixbufs_; #elif defined(OS_MACOSX) diff --git a/chrome/browser/defaults.cc b/chrome/browser/defaults.cc index 2be1d27..4c7a7c2 100644 --- a/chrome/browser/defaults.cc +++ b/chrome/browser/defaults.cc @@ -30,7 +30,11 @@ const double kAutocompleteEditFontPixelSizeInPopup = const int kAutocompletePopupFontSize = 10; +#if defined(TOOLKIT_VIEWS) +const bool kCanToggleSystemTitleBar = false; +#else const bool kCanToggleSystemTitleBar = true; +#endif #endif diff --git a/chrome/browser/gtk/bookmark_manager_gtk.cc b/chrome/browser/gtk/bookmark_manager_gtk.cc index 5ee3d53..0e54ccd 100644 --- a/chrome/browser/gtk/bookmark_manager_gtk.cc +++ b/chrome/browser/gtk/bookmark_manager_gtk.cc @@ -600,6 +600,7 @@ void BookmarkManagerGtk::ResetOrganizeMenu(bool left) { else if (parent) nodes.push_back(parent); +#if defined(TOOLKIT_GTK) // We DeleteSoon on the old one to give any reference holders (e.g. // the event that caused this reset) a chance to release their refs. BookmarkContextMenu* old_menu = organize_menu_.release(); @@ -609,7 +610,6 @@ void BookmarkManagerGtk::ResetOrganizeMenu(bool left) { organize_menu_.reset(new BookmarkContextMenu(window_, profile_, NULL, NULL, parent, nodes, BookmarkContextMenu::BOOKMARK_MANAGER_ORGANIZE_MENU, NULL)); -#if defined(TOOLKIT_GTK) gtk_menu_item_set_submenu(GTK_MENU_ITEM(organize_), organize_menu_->menu()); #else // GTK+Views should implement this somehow. @@ -1306,11 +1306,15 @@ gboolean BookmarkManagerGtk::OnTreeViewKeyPress( if (command == -1) return FALSE; +#if defined(TOOLKIT_GTK) if (bm->organize_menu_.get() && bm->organize_menu_->IsCommandEnabled(command)) { bm->organize_menu_->ExecuteCommand(command); return TRUE; } +#else + NOTIMPLEMENTED(); +#endif return FALSE; } diff --git a/chrome/browser/gtk/bookmark_manager_gtk.h b/chrome/browser/gtk/bookmark_manager_gtk.h index d70872e..4c19ba3 100644 --- a/chrome/browser/gtk/bookmark_manager_gtk.h +++ b/chrome/browser/gtk/bookmark_manager_gtk.h @@ -327,7 +327,9 @@ class BookmarkManagerGtk : public BookmarkModelObserver, // The Organize menu item. GtkWidget* organize_; // The submenu the item pops up. +#if defined(TOOLKIT_GTK) scoped_ptr<BookmarkContextMenu> organize_menu_; +#endif // Whether the menu refers to the left selection. bool organize_is_for_left_; diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc index 15d0b77..07a8d38 100644 --- a/chrome/browser/gtk/gtk_theme_provider.cc +++ b/chrome/browser/gtk/gtk_theme_provider.cc @@ -23,7 +23,6 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColor.h" #include "grit/app_resources.h" -//#include "grit/generated_resources.h" #include "grit/theme_resources.h" namespace { diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/gtk/options/content_page_gtk.cc index b634b69..8098a1b 100644 --- a/chrome/browser/gtk/options/content_page_gtk.cc +++ b/chrome/browser/gtk/options/content_page_gtk.cc @@ -52,8 +52,10 @@ ContentPageGtk::ContentPageGtk(Profile* profile) profile->GetPrefs(), this); ask_to_save_form_autofill_.Init(prefs::kFormAutofillEnabled, profile->GetPrefs(), this); - use_custom_chrome_frame_.Init(prefs::kUseCustomChromeFrame, - profile->GetPrefs(), this); + if (browser_defaults::kCanToggleSystemTitleBar) { + use_custom_chrome_frame_.Init(prefs::kUseCustomChromeFrame, + profile->GetPrefs(), this); + } // Load initial values NotifyPrefChanged(NULL); diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index d84be9c..f0dc61f 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -1110,7 +1110,7 @@ bool ProfileImpl::HasCreatedDownloadManager() const { void ProfileImpl::InitThemes() { if (!created_theme_provider_) { -#if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) +#if defined(OS_LINUX) theme_provider_.reset(new GtkThemeProvider); #else theme_provider_.reset(new BrowserThemeProvider); diff --git a/chrome/browser/views/dialog_stubs_gtk.cc b/chrome/browser/views/dialog_stubs_gtk.cc index 8df1833..c3a4e13 100644 --- a/chrome/browser/views/dialog_stubs_gtk.cc +++ b/chrome/browser/views/dialog_stubs_gtk.cc @@ -5,84 +5,91 @@ // This file contains stub implementations of the functions declared in // browser_dialogs.h that are currently unimplemented in GTK-views. +#include <gtk/gtk.h> + #include "base/logging.h" +#include "chrome/browser/gtk/about_chrome_dialog.h" #include "chrome/browser/fonts_languages_window.h" +#include "chrome/browser/gtk/bookmark_manager_gtk.h" +#include "chrome/browser/gtk/clear_browsing_data_dialog_gtk.h" +#include "chrome/browser/gtk/edit_search_engine_dialog.h" +#include "chrome/browser/gtk/keyword_editor_view.h" +#include "chrome/browser/gtk/options/passwords_exceptions_window_gtk.h" +#include "chrome/browser/gtk/repost_form_warning_gtk.h" +#include "chrome/browser/gtk/task_manager_gtk.h" #include "chrome/browser/options_window.h" #include "chrome/browser/views/browser_dialogs.h" +#include "views/widget/widget.h" namespace browser { void ShowBugReportView(views::Widget* parent, Profile* profile, TabContents* tab) { + // Bug report view hasn't been implemented on gtk yet. NOTIMPLEMENTED(); } void ShowClearBrowsingDataView(views::Widget* parent, Profile* profile) { - NOTIMPLEMENTED(); + ClearBrowsingDataDialogGtk::Show(GTK_WINDOW(parent->GetNativeView()), + profile); } void ShowSelectProfileDialog() { + // Only matters if we're going to support profile switching + // (switches::kEnableUserDataDirProfiles). NOTIMPLEMENTED(); } -void ShowImporterView(views::Widget* parent, - Profile* profile) { +void ShowImporterView(views::Widget* parent, Profile* profile) { + // Import currently doesn't matter. NOTIMPLEMENTED(); } void ShowBookmarkManagerView(Profile* profile) { - NOTIMPLEMENTED(); + BookmarkManagerGtk::Show(profile); } void ShowAboutChromeView(views::Widget* parent, Profile* profile) { - NOTIMPLEMENTED(); + ShowAboutDialogForProfile(GTK_WINDOW(parent->GetNativeView()), profile); } void ShowHtmlDialogView(gfx::NativeWindow parent, Browser* browser, HtmlDialogUIDelegate* delegate) { + // Hasn't been implemented yet on linux. NOTIMPLEMENTED(); } void ShowPasswordsExceptionsWindowView(Profile* profile) { - NOTIMPLEMENTED(); + ShowPasswordsExceptionsWindow(profile); } void ShowKeywordEditorView(Profile* profile) { - NOTIMPLEMENTED(); + KeywordEditorView::Show(profile); } void ShowNewProfileDialog() { + // Hasn't been implemented yet on linux. NOTIMPLEMENTED(); } void ShowTaskManager() { - NOTIMPLEMENTED(); + TaskManagerGtk::Show(); } void EditSearchEngine(gfx::NativeWindow parent, const TemplateURL* template_url, EditSearchEngineControllerDelegate* delegate, Profile* profile) { - NOTIMPLEMENTED(); + new EditSearchEngineDialog(GTK_WINDOW(parent), template_url, NULL, profile); } void ShowRepostFormWarningDialog(gfx::NativeWindow parent_window, TabContents* tab_contents) { - NOTIMPLEMENTED(); + new RepostFormWarningGtk(GTK_WINDOW(parent_window), + &tab_contents->controller()); } } // namespace browser - -void ShowOptionsWindow(OptionsPage page, - OptionsGroup highlight_group, - Profile* profile) { - NOTIMPLEMENTED(); -} -void ShowFontsLanguagesWindow(gfx::NativeWindow window, - FontsLanguagesPage page, - Profile* profile) { - NOTIMPLEMENTED(); -} diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index fdf61b2..430bfef 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -1019,10 +1019,12 @@ void ToolbarView::CreatePageMenu() { page_menu_contents_->AddSeparator(); page_menu_contents_->AddSubMenuWithStringId( IDS_DEVELOPER_MENU, devtools_menu_contents_.get()); -#endif page_menu_contents_->AddSeparator(); page_menu_contents_->AddItemWithStringId(IDC_REPORT_BUG, IDS_REPORT_BUG); +#else + NOTIMPLEMENTED(); +#endif page_menu_menu_.reset(new views::Menu2(page_menu_contents_.get())); } diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 1cd4fd3..829be6b 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -2664,8 +2664,18 @@ # Exclude all of browser/gtk, then include the things we want. ['exclude', '^browser/gtk'], + ['include', '^browser/gtk/about_chrome_dialog.cc'], + ['include', '^browser/gtk/about_chrome_dialog.h'], ['include', '^browser/gtk/autocomplete_edit_gtk.cc'], ['include', '^browser/gtk/autocomplete_edit_gtk.h'], + ['include', '^browser/gtk/bookmark_manager_gtk.cc'], + ['include', '^browser/gtk/bookmark_manager_gtk.h'], + ['include', '^browser/gtk/bookmark_tree_model.cc'], + ['include', '^browser/gtk/bookmark_tree_model.h'], + ['include', '^browser/gtk/bookmark_utils_gtk.cc'], + ['include', '^browser/gtk/bookmark_utils_gtk.h'], + ['include', '^browser/gtk/cairo_cached_surface.cc'], + ['include', '^browser/gtk/cairo_cached_surface.h'], ['include', '^browser/gtk/clear_browsing_data_dialog_gtk.cc'], ['include', '^browser/gtk/clear_browsing_data_dialog_gtk.h'], ['include', '^browser/gtk/dialogs_gtk.cc'], @@ -2678,8 +2688,12 @@ ['include', '^browser/gtk/first_run_dialog.h'], ['include', '^browser/gtk/focus_store_gtk.cc'], ['include', '^browser/gtk/focus_store_gtk.h'], + ['include', '^browser/gtk/gtk_chrome_button.cc'], + ['include', '^browser/gtk/gtk_chrome_button.h'], ['include', '^browser/gtk/gtk_chrome_link_button.cc'], ['include', '^browser/gtk/gtk_chrome_link_button.h'], + ['include', '^browser/gtk/gtk_theme_provider.cc'], + ['include', '^browser/gtk/gtk_theme_provider.h'], ['include', '^browser/gtk/hung_renderer_dialog_gtk.cc'], ['include', '^browser/gtk/hung_renderer_dialog_gtk.h'], ['include', '^browser/gtk/import_dialog_gtk.cc'], @@ -2690,17 +2704,25 @@ ['include', '^browser/gtk/import_lock_dialog_gtk.h'], ['include', '^browser/gtk/keyword_editor_view.cc'], ['include', '^browser/gtk/keyword_editor_view.h'], + ['include', '^browser/gtk/list_store_favicon_loader.cc'], + ['include', '^browser/gtk/list_store_favicon_loader.h'], ['include', '^browser/gtk/menu_gtk.cc'], ['include', '^browser/gtk/menu_gtk.h'], + ['include', '^browser/gtk/nine_box.cc'], + ['include', '^browser/gtk/nine_box.h'], + ['include', '^browser/gtk/options/'], + ['include', '^browser/gtk/repost_form_warning_gtk.cc'], + ['include', '^browser/gtk/repost_form_warning_gtk.h'], ['include', '^browser/gtk/tab_contents_drag_source.cc'], ['include', '^browser/gtk/tab_contents_drag_source.h'], + ['include', '^browser/gtk/task_manager_gtk.cc'], + ['include', '^browser/gtk/task_manager_gtk.h'], ['include', '^browser/gtk/view_id_util.cc'], ['include', '^browser/gtk/view_id_util.h'], # Other excluded stuff. ['exclude', '^browser/autocomplete/autocomplete_popup_view_gtk.cc'], ['exclude', '^browser/autocomplete/autocomplete_popup_view_gtk.h'], - ['exclude', '^browser/browser_theme_provider_gtk.cc'], ['exclude', '^browser/extensions/external_registry_extension_provider_win.cc'], ['exclude', '^browser/tab_contents/tab_contents_view_gtk.cc'], ['exclude', '^browser/tab_contents/tab_contents_view_gtk.h'], diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc index 2add0b0..f875e40 100644 --- a/chrome/common/temp_scaffolding_stubs.cc +++ b/chrome/common/temp_scaffolding_stubs.cc @@ -268,10 +268,5 @@ void BookmarkEditor::Show(gfx::NativeView parent_window, NOTIMPLEMENTED(); } -void BookmarkManager::SelectInTree(Profile* profile, const BookmarkNode* node) { -} -void BookmarkManager::Show(Profile* profile) { -} - #endif |