diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-06 03:39:18 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-06 03:39:18 +0000 |
commit | c61db1db11956890955bcd716c2841f9fa1a956f (patch) | |
tree | 74f87f9cd4c8df0fce38beb69ee055baf9cc9f32 /chrome | |
parent | 807e90d8ea383e85645ad33522e9f9e17a9f25f3 (diff) | |
download | chromium_src-c61db1db11956890955bcd716c2841f9fa1a956f.zip chromium_src-c61db1db11956890955bcd716c2841f9fa1a956f.tar.gz chromium_src-c61db1db11956890955bcd716c2841f9fa1a956f.tar.bz2 |
Remove many more ifdefs around un-used methods to enable more functionality for mac and linux.
Review URL: http://codereview.chromium.org/21118
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9304 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser.cc | 40 | ||||
-rw-r--r-- | chrome/browser/browser.h | 14 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.h | 17 |
3 files changed, 37 insertions, 34 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index a1c9aef..a79c5b5 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -2,19 +2,27 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/browser.h" + #include "base/command_line.h" #include "base/idle_timer.h" #include "base/logging.h" #include "base/string_util.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/browser_list.h" +#include "chrome/browser/browser_shutdown.h" #include "chrome/browser/location_bar.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/profile.h" +#include "chrome/browser/sessions/session_types.h" +#include "chrome/browser/tab_contents/navigation_controller.h" +#include "chrome/browser/tab_contents/navigation_entry.h" +#include "chrome/browser/tab_contents/site_instance.h" #include "chrome/browser/tab_contents/tab_contents_type.h" #include "chrome/browser/tab_contents/web_contents.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/l10n_util.h" #include "chrome/common/notification_service.h" #include "chrome/common/page_transition_types.h" #include "chrome/common/pref_names.h" @@ -34,12 +42,9 @@ #include <windows.h> #include <shellapi.h> -#include "chrome/browser/browser.h" - #include "chrome/app/locales/locale_settings.h" #include "chrome/browser/automation/ui_controls.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/browser_shutdown.h" #include "chrome/browser/browser_url_handler.h" #include "chrome/browser/browser_window.h" #include "chrome/browser/cert_store.h" @@ -57,9 +62,6 @@ #include "chrome/browser/ssl/ssl_error_info.h" #include "chrome/browser/status_bubble.h" #include "chrome/browser/tab_contents/interstitial_page.h" -#include "chrome/browser/tab_contents/navigation_controller.h" -#include "chrome/browser/tab_contents/navigation_entry.h" -#include "chrome/browser/tab_contents/site_instance.h" #include "chrome/browser/tab_contents/web_contents_view.h" #include "chrome/browser/task_manager.h" #include "chrome/browser/user_data_manager.h" @@ -67,7 +69,6 @@ #include "chrome/browser/views/download_tab_view.h" #include "chrome/browser/views/location_bar_view.h" #include "chrome/browser/window_sizer.h" -#include "chrome/common/l10n_util.h" #include "chrome/common/win_util.h" #include "chromium_strings.h" @@ -391,9 +392,8 @@ SkBitmap Browser::GetCurrentPageIcon() const { return contents ? contents->GetFavIcon() : SkBitmap(); } -#if defined(OS_WIN) - std::wstring Browser::GetCurrentPageTitle() const { +#if defined(OS_WIN) TabContents* contents = tabstrip_model_.GetSelectedTabContents(); std::wstring title; @@ -407,6 +407,10 @@ std::wstring Browser::GetCurrentPageTitle() const { title = l10n_util::GetString(IDS_TAB_UNTITLED_TITLE); return l10n_util::GetStringF(IDS_BROWSER_WINDOW_TITLE_FORMAT, title); +#elif defined(OS_POSIX) + // TODO(port): turn on when generating chrome_strings.h from grit + return L"untitled"; +#endif } // static @@ -420,6 +424,7 @@ void Browser::FormatTitleForDisplay(std::wstring* title) { } } + /////////////////////////////////////////////////////////////////////////////// // Browser, OnBeforeUnload handling: @@ -462,8 +467,6 @@ void Browser::OnWindowClosing() { CloseAllTabs(); } -#endif // OS_WIN - /////////////////////////////////////////////////////////////////////////////// // Browser, Tab adding/showing functions: @@ -496,8 +499,6 @@ TabContents* Browser::AddTabWithNavigationController( return tc; } -#if defined(OS_WIN) - NavigationController* Browser::AddRestoredTab( const std::vector<TabNavigation>& navigations, int tab_index, @@ -529,6 +530,7 @@ void Browser::ReplaceRestoredTab( restored_controller); } +#if defined(OS_WIN) void Browser::ShowNativeUITab(const GURL& url) { int i, c; TabContents* tc; @@ -546,7 +548,6 @@ void Browser::ShowNativeUITab(const GURL& url) { NULL); AddNewContents(NULL, contents, NEW_FOREGROUND_TAB, gfx::Rect(), true); } - #endif // OS_WIN /////////////////////////////////////////////////////////////////////////////// @@ -576,7 +577,6 @@ void Browser::GoForward() { GetSelectedTabContents()->controller()->GoForward(); } - void Browser::Reload() { UserMetrics::RecordAction(L"Reload", profile_); @@ -691,8 +691,6 @@ void Browser::SelectLastTab() { tabstrip_model_.SelectLastTab(); } -#if defined(OS_WIN) - void Browser::DuplicateTab() { UserMetrics::RecordAction(L"Duplicate", profile_); DuplicateContentsAt(selected_index()); @@ -752,6 +750,8 @@ void Browser::ViewSource() { } } +#if defined(OS_WIN) + void Browser::ClosePopups() { UserMetrics::RecordAction(L"CloseAllSuppressedPopups", profile_); GetSelectedTabContents()->CloseAllSuppressedPopups(); @@ -1108,7 +1108,6 @@ void Browser::ExecuteCommand(int id) { case IDC_SELECT_TAB_7: SelectNumberedTab(id - IDC_SELECT_TAB_0); break; case IDC_SELECT_LAST_TAB: SelectLastTab(); break; -#if defined(OS_WIN) case IDC_DUPLICATE_TAB: DuplicateTab(); break; case IDC_RESTORE_TAB: RestoreTab(); break; case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break; @@ -1117,6 +1116,7 @@ void Browser::ExecuteCommand(int id) { // Page-related commands case IDC_STAR: BookmarkCurrentPage(); break; case IDC_VIEW_SOURCE: ViewSource(); break; +#if defined(OS_WIN) case IDC_CLOSE_POPUPS: ClosePopups(); break; case IDC_PRINT: Print(); break; case IDC_SAVE_PAGE: SavePage(); break; @@ -2128,7 +2128,6 @@ void Browser::UpdateStopGoState(bool is_loading) { command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading); } -#if defined(OS_WIN) /////////////////////////////////////////////////////////////////////////////// // Browser, UI update coalescing and handling (private): @@ -2258,7 +2257,6 @@ void Browser::RemoveScheduledUpdatesFor(TabContents* contents) { } } -#endif // OS_WIN /////////////////////////////////////////////////////////////////////////////// // Browser, Getters for UI (private): @@ -2267,7 +2265,6 @@ StatusBubble* Browser::GetStatusBubble() { return window_->GetStatusBubble(); } -#if defined(OS_WIN) /////////////////////////////////////////////////////////////////////////////// // Browser, Session restore functions (private): @@ -2344,6 +2341,7 @@ bool Browser::HasCompletedUnloadProcessing() { tabs_needing_unload_fired_.empty(); } +#if defined(OS_WIN) void Browser::CancelWindowClose() { DCHECK(is_attempting_to_close_browser_); // Only cancelling beforeunload should be able to cancel the window's close. diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index d16a6b8..36fb097 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -138,7 +138,6 @@ class Browser : public TabStripModelDelegate, // Gets the FavIcon of the page in the selected tab. SkBitmap GetCurrentPageIcon() const; -#if defined(OS_WIN) // Gets the title of the page in the selected tab. std::wstring GetCurrentPageTitle() const; @@ -153,7 +152,6 @@ class Browser : public TabStripModelDelegate, // Invoked when the window containing us is closing. Performs the necessary // cleanup. void OnWindowClosing(); -#endif // OS_WIN // TabStripModel pass-thrus ///////////////////////////////////////////////// @@ -196,7 +194,6 @@ class Browser : public TabStripModelDelegate, TabContents* AddTabWithNavigationController(NavigationController* ctrl, PageTransition::Type type); -#if defined(OS_WIN) // Add a tab with its session history restored from the SessionRestore // system. If select is true, the tab is selected. Returns the created // NavigationController. |tab_index| gives the index to insert the tab at. @@ -217,14 +214,15 @@ class Browser : public TabStripModelDelegate, // Show a native UI tab given a URL. If a tab with the same URL is already // visible in this browser, it becomes selected. Otherwise a new tab is // created. +#if defined(OS_WIN) void ShowNativeUITab(const GURL& url); +#endif // Assorted browser commands //////////////////////////////////////////////// // NOTE: Within each of the following sections, the IDs are ordered roughly by // how they appear in the GUI/menus (left to right, top to bottom, etc.). -#endif // Navigation commands void GoBack(); void GoForward(); @@ -246,7 +244,6 @@ class Browser : public TabStripModelDelegate, void SelectPreviousTab(); void SelectNumberedTab(int index); void SelectLastTab(); -#if defined(OS_WIN) void DuplicateTab(); void RestoreTab(); void ConvertPopupToTabbedBrowser(); @@ -255,6 +252,7 @@ class Browser : public TabStripModelDelegate, // Page-related commands void BookmarkCurrentPage(); void ViewSource(); +#if defined(OS_WIN) void ClosePopups(); void Print(); void SavePage(); @@ -421,7 +419,6 @@ class Browser : public TabStripModelDelegate, // |is_loading| is true if the current TabContents is loading. void UpdateStopGoState(bool is_loading); -#if defined(OS_WIN) // UI update coalescing and handling //////////////////////////////////////// // Asks the toolbar (and as such the location bar) to update its state to @@ -448,7 +445,6 @@ class Browser : public TabStripModelDelegate, // TODO(beng): remove, and provide AutomationProvider a better way to access // the LocationBarView's edit. friend class AutomationProvider; -#endif // OS_WIN // Getters for the location bar and go button. GoButton* GetGoButton(); @@ -458,7 +454,6 @@ class Browser : public TabStripModelDelegate, // TODO(beng): remove this. StatusBubble* GetStatusBubble(); -#if defined(OS_WIN) // Session restore functions //////////////////////////////////////////////// // Notifies the history database of the index for all tabs whose index is @@ -473,17 +468,16 @@ class Browser : public TabStripModelDelegate, int selected_navigation); // OnBeforeUnload handling ////////////////////////////////////////////////// -#endif typedef std::set<TabContents*> UnloadListenerSet; -#if defined(OS_WIN) // Processes the next tab that needs it's beforeunload/unload event fired. void ProcessPendingTabs(); // Whether we've completed firing all the tabs' beforeunload/unload events. bool HasCompletedUnloadProcessing(); +#if defined(OS_WIN) // Clears all the state associated with processing tabs' beforeunload/unload // events since the user cancelled closing the window. void CancelWindowClose(); diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h index 681fdae..bd6dcbc 100644 --- a/chrome/common/temp_scaffolding_stubs.h +++ b/chrome/common/temp_scaffolding_stubs.h @@ -168,11 +168,13 @@ class SessionService : public base::RefCountedThreadSafe<SessionService> { public: explicit SessionService(Profile* profile) { } void WindowClosed(const SessionID &) { NOTIMPLEMENTED(); } - void SetWindowBounds(const SessionID&, const gfx::Rect&, bool) { - NOTIMPLEMENTED(); - } + void SetWindowBounds(const SessionID&, const gfx::Rect&, bool) + { NOTIMPLEMENTED(); } void ResetFromCurrentBrowsers() { NOTIMPLEMENTED(); } void TabRestored(NavigationController*) { NOTIMPLEMENTED(); } + void WindowClosing(const SessionID&) { NOTIMPLEMENTED(); } + void SetTabIndexInWindow(const SessionID&, const SessionID&, int) + { NOTIMPLEMENTED(); } }; class SessionRestore { @@ -197,6 +199,7 @@ class TabRestoreService : public base::RefCountedThreadSafe<TabRestoreService> { void BrowserClosing(Browser*) { NOTIMPLEMENTED(); } void BrowserClosed(Browser*) { NOTIMPLEMENTED(); } void CreateHistoricalTab(NavigationController*) { NOTIMPLEMENTED(); } + void RestoreMostRecentEntry(Browser*) { NOTIMPLEMENTED(); } }; namespace history { @@ -492,6 +495,11 @@ class AcceleratorHandler { //--------------------------------------------------------------------------- // These stubs are for Browser +class StatusBubble { + public: + void SetStatus(const std::wstring&) { NOTIMPLEMENTED(); } +}; + class SavePackage : public base::RefCountedThreadSafe<SavePackage>, public RenderViewHostDelegate::Save { public: @@ -737,6 +745,7 @@ class TabContents : public NotificationObserver { void UpdateMaxPageID(int32) { NOTIMPLEMENTED(); } virtual bool NavigateToPendingEntry(bool) { NOTIMPLEMENTED(); return true; } virtual DOMUIHost* AsDOMUIHost() { NOTIMPLEMENTED(); return NULL; } + virtual std::wstring GetStatusText() const { return std::wstring(); } static void RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kBlockPopups, false); } @@ -864,6 +873,8 @@ class BookmarkModel : public BookmarkService { virtual void BlockTillLoaded() { NOTIMPLEMENTED(); } void AddObserver(BookmarkModelObserver* observer) { NOTIMPLEMENTED(); } void RemoveObserver(BookmarkModelObserver* observer) { NOTIMPLEMENTED(); } + void SetURLStarred(const GURL&, const std::wstring, bool) + { NOTIMPLEMENTED(); } }; class SpellChecker : public base::RefCountedThreadSafe<SpellChecker> { |