diff options
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 2 | ||||
-rw-r--r-- | chrome/browser/back_forward_menu_model.cc | 2 | ||||
-rw-r--r-- | chrome/browser/browser.cc | 20 | ||||
-rw-r--r-- | chrome/browser/browser.h | 434 | ||||
-rw-r--r-- | chrome/browser/browser_commands.cc | 64 | ||||
-rw-r--r-- | chrome/browser/views/download_shelf_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 7 |
7 files changed, 236 insertions, 295 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 7b4fe8d..d3ac4bb 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -2230,7 +2230,7 @@ void AutomationProvider::BringBrowserToFront(const IPC::Message& message, int browser_handle) { if (browser_tracker_->ContainsHandle(browser_handle)) { Browser* browser = browser_tracker_->GetResource(browser_handle); - browser->MoveToFront(true); + browser->window()->Activate(); Send(new AutomationMsg_BringBrowserToFrontResponse(message.routing_id(), true)); } else { diff --git a/chrome/browser/back_forward_menu_model.cc b/chrome/browser/back_forward_menu_model.cc index 22651c1..76a6e61 100644 --- a/chrome/browser/back_forward_menu_model.cc +++ b/chrome/browser/back_forward_menu_model.cc @@ -225,7 +225,7 @@ void BackForwardMenuModel::ExecuteCommand(int menu_id) { if (menu_id == GetItemCount()) { UserMetrics::RecordComputedAction(BuildActionName(L"ShowFullHistory", -1), controller->profile()); - browser_->ShowNativeUI(HistoryTabUI::GetURL()); + browser_->ShowNativeUITab(HistoryTabUI::GetURL()); return; } diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 1eb818c..911805d 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -330,14 +330,6 @@ GURL Browser::GetHomePage() { } //////////////////////////////////////////////////////////////////////////////// -// Event Handlers - -void Browser::WindowActivationChanged(bool is_active) { - if (is_active) - BrowserList::SetLastActive(this); -} - -//////////////////////////////////////////////////////////////////////////////// // Toolbar creation, management LocationBarView* Browser::GetLocationBarView() const { @@ -512,7 +504,7 @@ void Browser::OpenURLFromTab(TabContents* source, b->OpenURL(url, referrer, disposition, transition); b->Show(); - b->MoveToFront(true); + b->window()->Activate(); return; } @@ -651,7 +643,7 @@ void Browser::AddNewContents(TabContents* source, transition = PageTransition::START_PAGE; b->tabstrip_model()->AddTabContents(new_contents, -1, transition, true); b->Show(); - b->MoveToFront(true); + b->window()->Activate(); return; } @@ -899,10 +891,6 @@ void Browser::ToolbarSizeChanged(TabContents* source, bool is_animating) { } } -void Browser::MoveToFront(bool should_activate) { - window_->Activate(); -} - bool Browser::ShouldCloseWindow() { if (HasCompletedUnloadProcessing()) { return true; @@ -1347,7 +1335,7 @@ void Browser::RemoveScheduledUpdatesFor(TabContents* contents) { } } -void Browser::ShowNativeUI(const GURL& url) { +void Browser::ShowNativeUITab(const GURL& url) { int i, c; TabContents* tc; for (i = 0, c = tabstrip_model_.count(); i < c; ++i) { @@ -1401,7 +1389,7 @@ void Browser::OpenURLOffTheRecord(Profile* profile, const GURL& url) { // TODO(eroman): should we have referrer here? browser->AddTabWithURL(url, GURL(), PageTransition::LINK, true, NULL); browser->Show(); - browser->MoveToFront(true); + browser->window()->Activate(); } void Browser::ConvertToTabbedBrowser() { diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index 48d6fef..34940d5 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -34,6 +34,8 @@ class Browser : public TabStripModelDelegate, public NotificationObserver, public SelectFileDialog::Listener { public: + // Constructors, Creation, Showing ////////////////////////////////////////// + // Creates a new browser with the given bounds. If the bounds are empty, the // system will try to find a saved size from a previous session, if none // exists, the operating system will be allowed to size the window. @@ -48,8 +50,6 @@ class Browser : public TabStripModelDelegate, const std::wstring& app_name); ~Browser(); - BrowserType::Type type() const { return type_; } - // Shows the browser window. It is initially created hidden. It will be shown // with the show command passed to the constructor, or possibly another state // if it was overridden in the preferences. @@ -58,94 +58,68 @@ class Browser : public TabStripModelDelegate, // initialized so that we do not have to repaint again. void Show(); - // Returns the Browser which contains the tab with the given - // NavigationController, also filling in |index| (if valid) with the tab's - // index in the tab strip. - // Returns NULL if not found. - // This call is O(N) in the number of tabs. - static Browser* GetBrowserForController( - const NavigationController* controller, int* index); - - static void OpenNewBrowserWindow(Profile* profile, int show_command); - - static void RegisterPrefs(PrefService* prefs); - static void RegisterUserPrefs(PrefService* prefs); - - void GoBack(); - void GoForward(); - void Stop(); - void Reload(); - void Home(); - - // "Stars" or (book)marks the contents of the current tab. - void StarCurrentTabContents(); - - // Opens the FindInPage window for the currently open tab. - void OpenFindInPageWindow(); - - // debugger shell - void OpenDebuggerWindow(); - - // Advance the find selection by one. Direction is either forward or backwards - // depending on parameter passed in. - void AdvanceFindSelection(bool forward_direction); + // Accessors //////////////////////////////////////////////////////////////// + BrowserType::Type type() const { return type_; } Profile* profile() const { return profile_; } - BrowserWindow* window() const { return window_; } - ToolbarModel* toolbar_model() { return &toolbar_model_; } + const SessionID& session_id() const { return session_id_; } + CommandController* controller() { return &controller_; } - // Returns the HWND of the top-level system window for this Browser. - HWND GetTopLevelHWND() const; + // Browser Creation Helpers ///////////////////////////////////////////////// - // Update commands that drive the NavigationController to reflect changes in - // the NavigationController's state (Back, Forward, etc). - void UpdateNavigationCommands(); + // Opens a new browser window for the specified |profile|, shown according to + // |show_command| + static void OpenNewBrowserWindow(Profile* profile, int show_command); + + // Opens the specified URL in a new browser window in an incognito session. + // If there is already an existing active incognito session for the specified + // |profile|, that session is re-used. + static void OpenURLOffTheRecord(Profile* profile, const GURL& url); + + // Opens the a new application window for the specified WebApp. + static void OpenWebApplication(Profile* profile, + WebApp* app, + int show_command); - // CommandHandler interface method implementation - bool GetContextualLabel(int id, std::wstring* out) const; - void ExecuteCommand(int id); + // Command API ////////////////////////////////////////////////////////////// // Please fix the incestuous nest that is */controller.h and eliminate the // need for this retarded hack. bool SupportsCommand(int id) const; bool IsCommandEnabled(int id) const; - // Sets focus on the location bar's text field. - void FocusLocationBar(); + // DEPRECATED DEPRECATED DEPRECATED ///////////////////////////////////////// - // Notification that some of our content has animated. If the source - // is the current tab, this invokes the same method on the frame. - void ToolbarSizeChanged(TabContents* source, bool is_animating); + // Returns the HWND of the top-level system window for this Browser. + HWND GetTopLevelHWND() const; - // Move the window to the front. - void MoveToFront(bool should_activate); + // State Storage and Retrieval for UI /////////////////////////////////////// - // Unique identifier for this window; used for session restore. - const SessionID& session_id() const { return session_id_; } + // Save and restore the window position. + void SaveWindowPosition(const gfx::Rect& bounds, bool maximized); + void RestoreWindowPosition(gfx::Rect* bounds, bool* maximized); + + // Gets the FavIcon of the page in the selected tab. + SkBitmap GetCurrentPageIcon() const; + + // Gets the title of the page in the selected tab. + std::wstring GetCurrentPageTitle() const; - // Executes a Windows WM_APPCOMMAND command id. This function translates a - // button-specific identifier to an id understood by our controller. - bool ExecuteWindowsAppCommand(int app_command_id); + // Prepares a title string for display (removes embedded newlines, etc). + static void FormatTitleForDisplay(std::wstring* title); + + // OnBeforeUnload handling ////////////////////////////////////////////////// // Gives beforeunload handlers the chance to cancel the close. bool ShouldCloseWindow(); - // Tells us that we've finished firing this tab's beforeunload event. - // The proceed bool tells us whether the user chose to proceed closing the - // tab. Returns true if the tab can continue on firing it's unload event. - // If we're closing the entire browser, then we'll want to delay firing - // unload events until all the beforeunload events have fired. - void BeforeUnloadFired(TabContents* source, - bool proceed, - bool* proceed_to_fire_unload); - // Invoked when the window containing us is closing. Performs the necessary // cleanup. void OnWindowClosing(); - // TabStripModel pass-thrus ////////////////////////////////////////////////// + // TabStripModel pass-thrus ///////////////////////////////////////////////// TabStripModel* tabstrip_model() const { return const_cast<TabStripModel*>(&tabstrip_model_); @@ -173,7 +147,7 @@ class Browser : public TabStripModelDelegate, tabstrip_model_.CloseAllTabs(); } - // Tab Creation functions //////////////////////////////////////////////////// + // Tab adding/showing functions ///////////////////////////////////////////// // Add a new tab with the specified URL. If instance is not null, its process // will be used to render the tab. @@ -197,8 +171,8 @@ class Browser : public TabStripModelDelegate, // 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. - // |selected_navigation| is the index of the TabNavigation in |navigations| to - // select. + // |selected_navigation| is the index of the TabNavigation in |navigations| + // to select. NavigationController* AddRestoredTab( const std::vector<TabNavigation>& navigations, int tab_index, @@ -211,6 +185,77 @@ class Browser : public TabStripModelDelegate, const std::vector<TabNavigation>& navigations, int selected_navigation); + // 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. + void ShowNativeUITab(const GURL& url); + + // Assorted Browser Commands //////////////////////////////////////////////// + + // Navigation Commands + void GoBack(); + void GoForward(); + void Reload(); + void Stop(); + void Home(); + + // Sets focus on the location bar's text field - public because + void FocusLocationBar(); + + // Adds a Bookmark for the currently selected tab. + void BookmarkCurrentPage(); + + // Opens the FindInPage window for the currently open tab. + void OpenFindInPageWindow(); + + // debugger shell + void OpenDebuggerWindow(); + + // Advance the find selection by one. Direction is either forward or + // backwards depending on parameter passed in. + void AdvanceFindSelection(bool forward_direction); + + // Convert the receiving Browser to a normal browser window. This is used to + // convert a popup window into a normal browser window. The receiver's type + // must be BROWSER. + void ConvertToTabbedBrowser(); + + // Opens the Keyword Editor + void OpenKeywordEditor(); + + // Opens the Clear Browsing Data dialog. + void OpenClearBrowsingDataDialog(); + + // Opens the Import settings dialog. + void OpenImportSettingsDialog(); + + // Opens the Bug Report dialog. + void OpenBugReportDialog(); + + // Copy the current page URL to the clipboard. + void CopyCurrentURLToClipBoard(); + + ///////////////////////////////////////////////////////////////////////////// + + static void RegisterPrefs(PrefService* prefs); + static void RegisterUserPrefs(PrefService* prefs); + + // Returns the Browser which contains the tab with the given + // NavigationController, also filling in |index| (if valid) with the tab's + // index in the tab strip. + // Returns NULL if not found. + // This call is O(N) in the number of tabs. + static Browser* GetBrowserForController( + const NavigationController* controller, int* index); + + // Interface implementations //////////////////////////////////////////////// + + // Overridden from CommandHandler: + virtual bool GetContextualLabel(int id, std::wstring* out) const { + return false; + } + virtual void ExecuteCommand(int id); + // Overridden from TabStripDelegate: virtual void CreateNewStripWithContents(TabContents* detached_contents, const gfx::Point& drop_point); @@ -265,6 +310,7 @@ class Browser : public TabStripModelDelegate, virtual void CloseContents(TabContents* source); virtual void MoveContents(TabContents* source, const gfx::Rect& pos); virtual bool IsPopup(TabContents* source); + virtual void ToolbarSizeChanged(TabContents* source, bool is_animating); virtual void URLStarredChanged(TabContents* source, bool starred); virtual void ContentsMouseEvent(TabContents* source, UINT message); @@ -275,105 +321,35 @@ class Browser : public TabStripModelDelegate, virtual void ConvertContentsToApplication(TabContents* source); virtual void ContentsStateChanged(TabContents* source); virtual bool ShouldDisplayURLField(); - - // Show some native UI 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. - void ShowNativeUI(const GURL& url); - - // Show a dialog with HTML content. |delegate| contains a pointer to the - // delegate who knows how to display the dialog (which file URL and JSON - // string input to use during initialization). |parent_hwnd| is the window - // that should be the parent of this dialog, or NULL for this browser's top - // level hwnd. - // TODO(beng): (Cleanup) this really shouldn't live here. It's not - // necessarily browser-related (e.g. can be called from options - // dialog). - void ShowHtmlDialog(HtmlDialogContentsDelegate* delegate, HWND parent_hwnd); + virtual void BeforeUnloadFired(TabContents* source, + bool proceed, + bool* proceed_to_fire_unload); + virtual void ShowHtmlDialog(HtmlDialogContentsDelegate* delegate, + HWND parent_hwnd); // Overridden from SelectFileDialog::Listener: virtual void FileSelected(const std::wstring& path, void* params); - // Start an off the record session. If a window containing an off the record - // tab for the current profile exists, create a new off the record tab in that - // window. Otherwise, create a new window with an off the record tab. - static void OpenURLOffTheRecord(Profile* p, const GURL& url); - - // Compute a deterministic name based on the URL. We use this pseudo name - // as a key to store window location per application URLs. - static std::wstring ComputeApplicationNameFromURL(const GURL& url); - - // Start a web application. - static void OpenWebApplication(Profile* profile, - WebApp* app, - int show_command); - - // Return this browser's controller. - CommandController* controller() { return &controller_; } - - // Returns the location bar view for this browser. - LocationBarView* GetLocationBarView() const; - - // NEW FRAME METHODS BELOW THIS LINE ONLY... TODO(beng): clean up this file! - - // Save and restore the window position. - void SaveWindowPosition(const gfx::Rect& bounds, bool maximized); - void RestoreWindowPosition(gfx::Rect* bounds, bool* maximized); - - // Gets the FavIcon of the page in the selected tab. - SkBitmap GetCurrentPageIcon() const; - - // Gets the title of the page in the selected tab. - std::wstring GetCurrentPageTitle() const; - - // Prepares a title string for display (removes embedded newlines, etc). - static void FormatTitleForDisplay(std::wstring* title); + // Overridden from NotificationObserver: + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); private: - friend class BrowserView; - - // Tracks invalidates to the UI, see the declaration in the .cc file. - struct UIUpdate; - typedef std::vector<UIUpdate> UpdateVector; - - typedef std::vector<TabContents*> UnloadListenerVector; - - // Closes the frame. - void CloseFrame(); - - // Returns what the user's home page is, or the new tab page if the home page - // has not been set. - GURL GetHomePage(); - - // Called when this window gains or loses window-manager-level activation. - // is_active is whether or not the Window is now active. - void WindowActivationChanged(bool is_active); + // Command and State Updating /////////////////////////////////////////////// // Initialize state for all browser commands. void InitCommandState(); + // Update commands that drive the NavigationController to reflect changes in + // the NavigationController's state (Back, Forward, etc). + void UpdateNavigationCommands(); + // Change the "starred" button display to starred/unstarred. // TODO(evanm): migrate this to the commands framework. void SetStarredButtonToggled(bool starred); - GoButton* GetGoButton(); - - // Returns the StatusBubble from the current toolbar. It is possible for - // this to return NULL if called before the toolbar has initialized. - // TODO(beng): remove this. - StatusBubble* GetStatusBubble(); - - // Notifies the history database of the index for all tabs whose index is - // >= index. - void SyncHistoryWithTabs(int index); - - // Notification service callback. - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); - - // The Controller that updates all browser commands. - CommandController controller_; + // UI update coalescing and handling //////////////////////////////////////// // Asks the toolbar (and as such the location bar) to update its state to // reflect the current tab's current URL, security state, etc. @@ -385,40 +361,35 @@ class Browser : public TabStripModelDelegate, // Adds an update to the update queue and schedules an update if necessary. // These are subsequently processed by ProcessPendingUIUpdates. // |changed_flags| is a bitfield of TabContents::INVALIDATE_* values. - void ScheduleUIUpdate(const TabContents* source, - unsigned changed_flags); + void ScheduleUIUpdate(const TabContents* source, unsigned changed_flags); // Processes all pending updates to the UI that have been queued by // ScheduleUIUpdate in scheduled_updates_. void ProcessPendingUIUpdates(); - // Update the current page title - void UpdateTitle(); - - // Opens the Keyword Editor - void OpenKeywordEditor(); - - // Opens the Clear Browsing Data dialog. - void OpenClearBrowsingDataDialog(); + // Removes all entries from scheduled_updates_ whose source is contents. + void RemoveScheduledUpdatesFor(TabContents* contents); - // Opens the Import settings dialog. - void OpenImportSettingsDialog(); + // Getters for UI /////////////////////////////////////////////////////////// - // Opens the Bug Report dialog. - void OpenBugReportDialog(); + // TODO(beng): remove, and provide AutomationProvider a better way to access + // the LocationBarView's edit. + friend class AutomationProvider; - // Copy the current page URL to the clipboard. - void CopyCurrentURLToClipBoard(); + // Getters for the location bar and go button. + LocationBarView* GetLocationBarView() const; + GoButton* GetGoButton(); - // Initializes the hang monitor. - void InitHangMonitor(); + // Returns the StatusBubble from the current toolbar. It is possible for + // this to return NULL if called before the toolbar has initialized. + // TODO(beng): remove this. + StatusBubble* GetStatusBubble(); - // Retrieve the last active tabbed browser with the same profile as the - // receiving Browser. Creates a new Browser if none are available. - Browser* GetOrCreateTabbedBrowser(); + // Session restore functions //////////////////////////////////////////////// - // Removes all entries from scheduled_updates_ whose source is contents. - void RemoveScheduledUpdatesFor(TabContents* contents); + // Notifies the history database of the index for all tabs whose index is + // >= index. + void SyncHistoryWithTabs(int index); // Called from AddRestoredTab and ReplaceRestoredTab to build a // NavigationController from an incoming vector of TabNavigations. @@ -427,21 +398,9 @@ class Browser : public TabStripModelDelegate, const std::vector<TabNavigation>& navigations, int selected_navigation); - // Convert the receiving Browser to a normal browser window. This is used to - // convert a popup window into a normal browser window. The receiver's type - // must be BROWSER. - void ConvertToTabbedBrowser(); - - // Create a preference dictionary for the provided application name. This is - // done only once per application name / per session. - static void RegisterAppPrefs(const std::wstring& app_name); + // OnBeforeUnload handling ////////////////////////////////////////////////// - // Creates a new popup window with its own Browser object with the - // incoming sizing information. |initial_pos|'s origin() is the - // window origin, and its size() is the size of the content area. - void BuildPopupWindow(TabContents* source, - TabContents* new_contents, - const gfx::Rect& initial_pos); + typedef std::vector<TabContents*> UnloadListenerVector; // Processes the next tab that needs it's beforeunload/unload event fired. void ProcessPendingTabs(); @@ -464,7 +423,45 @@ class Browser : public TabStripModelDelegate, // successfully fired. void ClearUnloadState(TabContents* tab); - // The frame + // Assorted utility functions /////////////////////////////////////////////// + + // Retrieve the last active tabbed browser with the same profile as the + // receiving Browser. Creates a new Browser if none are available. + Browser* GetOrCreateTabbedBrowser(); + + // Creates a new popup window with its own Browser object with the + // incoming sizing information. |initial_pos|'s origin() is the + // window origin, and its size() is the size of the content area. + void BuildPopupWindow(TabContents* source, + TabContents* new_contents, + const gfx::Rect& initial_pos); + + // Returns what the user's home page is, or the new tab page if the home page + // has not been set. + GURL GetHomePage(); + + // Closes the frame. + // TODO(beng): figure out if we need this now that the frame itself closes + // after a return to the message loop. + void CloseFrame(); + + // Compute a deterministic name based on the URL. We use this pseudo name + // as a key to store window location per application URLs. + static std::wstring ComputeApplicationNameFromURL(const GURL& url); + + // Create a preference dictionary for the provided application name. This is + // done only once per application name / per session. + static void RegisterAppPrefs(const std::wstring& app_name); + + // Data members ///////////////////////////////////////////////////////////// + + // This Browser's type. + BrowserType::Type type_; + + // This Browser's profile. + Profile* profile_; + + // This Browser's window. BrowserWindow* window_; // Controls how the window will appear when Show() is called. This is one @@ -477,10 +474,25 @@ class Browser : public TabStripModelDelegate, // BrowserView, or some more likely place. int initial_show_command_; + // This Browser's TabStripModel. + TabStripModel tabstrip_model_; + + // The Controller that updates all browser commands. + CommandController controller_; + + // An optional application name which is used to retrieve and save window + // positions. + std::wstring app_name_; + + // Unique identifier of this browser for session restore. This id is only + // unique within the current session, and is not guaranteed to be unique + // across sessions. + SessionID session_id_; + // TODO(beng): should be combined with ToolbarModel now that this is the only // implementation. class BrowserToolbarModel : public ToolbarModel { - public: + public: explicit BrowserToolbarModel(Browser* browser) : browser_(browser) { } virtual ~BrowserToolbarModel() { } @@ -489,7 +501,7 @@ class Browser : public TabStripModelDelegate, return browser_->GetSelectedNavigationController(); } - private: + private: Browser* browser_; DISALLOW_EVIL_CONSTRUCTORS(BrowserToolbarModel); @@ -498,9 +510,21 @@ class Browser : public TabStripModelDelegate, // The model for the toolbar view. BrowserToolbarModel toolbar_model_; - TabStripModel tabstrip_model_; + // UI update coalescing and handling //////////////////////////////////////// - Profile* profile_; + // Tracks invalidates to the UI, see the declaration in the .cc file. + struct UIUpdate; + typedef std::vector<UIUpdate> UpdateVector; + + // Lists all UI updates that are pending. We don't update things like the + // URL or tab title right away to avoid flickering and extra painting. + // See ScheduleUIUpdate and ProcessPendingUIUpdates. + UpdateVector scheduled_updates_; + + // The following factory is used for chrome update coalescing. + ScopedRunnableMethodFactory<Browser> chrome_updater_factory_; + + // OnBeforeUnload handling ////////////////////////////////////////////////// // Tracks tabs that need there beforeunload event fired before we can // close the browser. Only gets populated when we try to close the browser. @@ -514,29 +538,11 @@ class Browser : public TabStripModelDelegate, // in preparation for closing the browser. bool is_attempting_to_close_browser_; - // The following factory is used for chrome update coalescing. - ScopedRunnableMethodFactory<Browser> chrome_updater_factory_; + ///////////////////////////////////////////////////////////////////////////// // The following factory is used to close the frame at a later time. ScopedRunnableMethodFactory<Browser> method_factory_; - // This browser type. - BrowserType::Type type_; - - // Lists all UI updates that are pending. We don't update things like the - // URL or tab title right away to avoid flickering and extra painting. - // See ScheduleUIUpdate and ProcessPendingUIUpdates. - UpdateVector scheduled_updates_; - - // An optional application name which is used to retrieve and save window - // positions. - std::wstring app_name_; - - // Unique identifier of this browser for session restore. This id is only - // unique within the current session, and is not guaranteed to be unique - // across sessions. - SessionID session_id_; - // Debugger Window, created lazily scoped_refptr<DebuggerWindow> debugger_window_; diff --git a/chrome/browser/browser_commands.cc b/chrome/browser/browser_commands.cc index 6b90148..332393b 100644 --- a/chrome/browser/browser_commands.cc +++ b/chrome/browser/browser_commands.cc @@ -167,62 +167,10 @@ bool Browser::SupportsCommand(int id) const { return controller_.SupportsCommand(id); } -bool Browser::ExecuteWindowsAppCommand(int app_command) { - switch (app_command) { - case APPCOMMAND_BROWSER_BACKWARD: - controller_.ExecuteCommand(IDC_BACK); - return true; - case APPCOMMAND_BROWSER_FORWARD: - controller_.ExecuteCommand(IDC_FORWARD); - return true; - case APPCOMMAND_BROWSER_REFRESH: - controller_.ExecuteCommand(IDC_RELOAD); - return true; - case APPCOMMAND_BROWSER_HOME: - controller_.ExecuteCommand(IDC_HOME); - return true; - case APPCOMMAND_BROWSER_STOP: - controller_.ExecuteCommand(IDC_STOP); - return true; - case APPCOMMAND_BROWSER_SEARCH: - controller_.ExecuteCommand(IDC_FOCUS_SEARCH); - return true; - case APPCOMMAND_CLOSE: - controller_.ExecuteCommand(IDC_CLOSETAB); - return true; - case APPCOMMAND_NEW: - controller_.ExecuteCommand(IDC_NEWTAB); - return true; - case APPCOMMAND_OPEN: - controller_.ExecuteCommand(IDC_OPENFILE); - return true; - case APPCOMMAND_PRINT: - controller_.ExecuteCommand(IDC_PRINT); - return true; - - // TODO(pkasting): http://b/1113069 Handle all these. - case APPCOMMAND_HELP: - case APPCOMMAND_SAVE: - case APPCOMMAND_UNDO: - case APPCOMMAND_REDO: - case APPCOMMAND_COPY: - case APPCOMMAND_CUT: - case APPCOMMAND_PASTE: - case APPCOMMAND_SPELL_CHECK: - default: - return false; - } - return false; -} - //////////////////////////////////////////////////////////////////////////////// // CommandController implementation // -bool Browser::GetContextualLabel(int id, std::wstring* out) const { - return false; -} - bool Browser::IsCommandEnabled(int id) const { switch (id) { case IDC_BACK: { @@ -294,7 +242,7 @@ void Browser::ExecuteCommand(int id) { Browser* b = GetOrCreateTabbedBrowser(); DCHECK(b); b->Show(); - b->MoveToFront(true); + b->window()->Activate(); b->AddBlankTab(true); } break; @@ -353,7 +301,7 @@ void Browser::ExecuteCommand(int id) { case IDC_STAR: UserMetrics::RecordAction(L"Star", profile_); - StarCurrentTabContents(); + BookmarkCurrentPage(); break; case IDC_OPENURL: @@ -665,12 +613,12 @@ void Browser::ExecuteCommand(int id) { case IDC_SHOW_HISTORY: UserMetrics::RecordAction(L"ShowHistory", profile_); - ShowNativeUI(HistoryTabUI::GetURL()); + ShowNativeUITab(HistoryTabUI::GetURL()); break; case IDC_SHOW_DOWNLOADS: UserMetrics::RecordAction(L"ShowDownloads", profile_); - ShowNativeUI(DownloadTabUI::GetURL()); + ShowNativeUITab(DownloadTabUI::GetURL()); break; case IDC_OPTIONS: @@ -781,7 +729,7 @@ void Browser::Home() { homepage_url, GURL(), PageTransition::AUTO_BOOKMARK); } -void Browser::StarCurrentTabContents() { +void Browser::BookmarkCurrentPage() { TabContents* tab = GetSelectedTabContents(); if (!tab || !tab->AsWebContents()) return; @@ -971,7 +919,7 @@ void Browser::DuplicateContentsAt(int index) { contents->controller()->Clone(new_browser->GetTopLevelHWND()), PageTransition::LINK); - new_browser->MoveToFront(true); + new_browser->window()->Activate(); } if (profile_->HasSessionService()) { diff --git a/chrome/browser/views/download_shelf_view.cc b/chrome/browser/views/download_shelf_view.cc index 9a36ab5..a1538a4 100644 --- a/chrome/browser/views/download_shelf_view.cc +++ b/chrome/browser/views/download_shelf_view.cc @@ -263,7 +263,7 @@ void DownloadShelfView::LinkActivated(views::Link* source, int event_flags) { NavigationController* controller = tab_contents_->controller(); Browser* browser = Browser::GetBrowserForController(controller, &index); DCHECK(browser); - browser->ShowNativeUI(DownloadTabUI::GetURL()); + browser->ShowNativeUITab(DownloadTabUI::GetURL()); } void DownloadShelfView::ButtonPressed(views::BaseButton* button) { diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index e26cc95..41088fe 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -216,7 +216,7 @@ bool BrowserView::ActivateAppModalDialog() const { Browser* active_browser = BrowserList::GetLastActive(); if (active_browser && (browser_ != active_browser)) { active_browser->window()->FlashFrame(); - active_browser->MoveToFront(true); + active_browser->window()->Activate(); } AppModalDialogQueue::ActivateModalDialog(); return true; @@ -225,9 +225,8 @@ bool BrowserView::ActivateAppModalDialog() const { } void BrowserView::ActivationChanged(bool activated) { - // The Browser wants to update the BrowserList to let it know it's now - // active. - browser_->WindowActivationChanged(activated); + if (activated) + BrowserList::SetLastActive(browser_.get()); } TabContents* BrowserView::GetSelectedTabContents() const { |