diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-08 19:55:14 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-08 19:55:14 +0000 |
commit | 8f0d1a2b4004082e5e46009d4446a59dff805928 (patch) | |
tree | aabb0e55875425a5187eb8e724aa4b4a17ebe6c9 /chrome | |
parent | ed764d167c3f9653b9eec17ecc2042ea3c0a6611 (diff) | |
download | chromium_src-8f0d1a2b4004082e5e46009d4446a59dff805928.zip chromium_src-8f0d1a2b4004082e5e46009d4446a59dff805928.tar.gz chromium_src-8f0d1a2b4004082e5e46009d4446a59dff805928.tar.bz2 |
Add about:memory link to task manager.
Since about:memory DCHECK()s atm, the link is not completely hooked up.
In the xib, I've added a square button with height 14 and the new HyperlinkCell, contained in a GTMWidthBasedResizer or how it's called. I made sure the baseline of link on the left and button on the right is at the same height.
BUG=17989,13156
TEST=Open MainMenu.xib, click "Enable" for view->dev->taskman. Build&run chrome. Task manager should contain link.
Review URL: http://codereview.chromium.org/255018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28426 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/nibs/TaskManager.xib | 137 | ||||
-rw-r--r-- | chrome/browser/cocoa/task_manager_mac.h | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/task_manager_mac.mm | 5 | ||||
-rw-r--r-- | chrome/browser/gtk/task_manager_gtk.cc | 16 | ||||
-rw-r--r-- | chrome/browser/task_manager.cc | 19 | ||||
-rw-r--r-- | chrome/browser/task_manager.h | 2 | ||||
-rw-r--r-- | chrome/browser/views/task_manager_view.cc | 16 |
7 files changed, 120 insertions, 77 deletions
diff --git a/chrome/app/nibs/TaskManager.xib b/chrome/app/nibs/TaskManager.xib index ec1dd9e..30ed88d 100644 --- a/chrome/app/nibs/TaskManager.xib +++ b/chrome/app/nibs/TaskManager.xib @@ -8,7 +8,7 @@ <string key="IBDocument.HIToolboxVersion">353.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="3"/> + <integer value="2"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -80,7 +80,7 @@ <object class="NSMutableArray" key="NSTableColumns"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTableColumn" id="694001717"> - <double key="NSWidth">1.010000e+02</double> + <double key="NSWidth">4.200000e+02</double> <double key="NSMinWidth">4.000000e+01</double> <double key="NSMaxWidth">1.000000e+03</double> <object class="NSTableHeaderCell" key="NSHeaderCell"> @@ -120,12 +120,12 @@ <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">controlBackgroundColor</string> - <object class="NSColor" key="NSColor" id="1010533372"> + <object class="NSColor" key="NSColor"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MC42NjY2NjY2OQA</bytes> </object> </object> - <object class="NSColor" key="NSTextColor" id="1040882968"> + <object class="NSColor" key="NSTextColor"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">controlTextColor</string> @@ -215,27 +215,6 @@ <reference key="NSCornerView" ref="704068535"/> <bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes> </object> - <object class="NSTextField" id="976181670"> - <reference key="NSNextResponder" ref="1006"/> - <int key="NSvFlags">292</int> - <string key="NSFrame">{{17, 22}, {77, 17}}</string> - <reference key="NSSuperview" ref="1006"/> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="699552686"> - <int key="NSCellFlags">68288064</int> - <int key="NSCellFlags2">272630784</int> - <string key="NSContents">TODO: Link</string> - <reference key="NSSupport" ref="746983650"/> - <reference key="NSControlView" ref="976181670"/> - <object class="NSColor" key="NSBackgroundColor"> - <int key="NSColorSpace">6</int> - <string key="NSCatalogName">System</string> - <string key="NSColorName">controlColor</string> - <reference key="NSColor" ref="1010533372"/> - </object> - <reference key="NSTextColor" ref="1040882968"/> - </object> - </object> <object class="NSCustomView" id="369147393"> <reference key="NSNextResponder" ref="1006"/> <int key="NSvFlags">289</int> @@ -243,7 +222,7 @@ <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSButton" id="310898064"> <reference key="NSNextResponder" ref="369147393"/> - <int key="NSvFlags">268</int> + <int key="NSvFlags">289</int> <string key="NSFrame">{{14, 12}, {96, 32}}</string> <reference key="NSSuperview" ref="369147393"/> <bool key="NSEnabled">YES</bool> @@ -266,6 +245,41 @@ <reference key="NSSuperview" ref="1006"/> <string key="NSClassName">GTMWidthBasedTweaker</string> </object> + <object class="NSCustomView" id="110574594"> + <reference key="NSNextResponder" ref="1006"/> + <int key="NSvFlags">292</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSButton" id="876279762"> + <reference key="NSNextResponder" ref="110574594"/> + <int key="NSvFlags">292</int> + <string key="NSFrame">{{14, 22}, {96, 14}}</string> + <reference key="NSSuperview" ref="110574594"/> + <bool key="NSEnabled">YES</bool> + <object class="NSButtonCell" key="NSCell" id="481205052"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">134217728</int> + <string key="NSContents">^IDS_TASK_MANAGER_ABOUT_MEMORY_LINK</string> + <reference key="NSSupport" ref="746983650"/> + <reference key="NSControlView" ref="876279762"/> + <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags2">134</int> + <object class="NSFont" key="NSAlternateImage"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">1.300000e+01</double> + <int key="NSfFlags">16</int> + </object> + <string key="NSAlternateContents"/> + <string key="NSKeyEquivalent"/> + <int key="NSPeriodicDelay">200</int> + <int key="NSPeriodicInterval">25</int> + </object> + </object> + </object> + <string key="NSFrameSize">{124, 60}</string> + <reference key="NSSuperview" ref="1006"/> + <string key="NSClassName">GTMWidthBasedTweaker</string> + </object> </object> <string key="NSFrameSize">{480, 270}</string> <reference key="NSSuperview"/> @@ -323,6 +337,14 @@ </object> <int key="connectionID">23</int> </object> + <object class="IBConnectionRecord"> + <object class="IBActionConnection" key="connection"> + <string key="label">statsLinkClicked:</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="876279762"/> + </object> + <int key="connectionID">30</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -368,8 +390,8 @@ <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> <reference ref="69694332"/> - <reference ref="976181670"/> <reference ref="369147393"/> + <reference ref="110574594"/> </object> <reference key="parent" ref="1005"/> </object> @@ -424,20 +446,6 @@ <reference key="parent" ref="694001717"/> </object> <object class="IBObjectRecord"> - <int key="objectID">14</int> - <reference key="object" ref="976181670"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="699552686"/> - </object> - <reference key="parent" ref="1006"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">15</int> - <reference key="object" ref="699552686"/> - <reference key="parent" ref="976181670"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">17</int> <reference key="object" ref="680042460"/> <reference key="parent" ref="1002"/> @@ -470,6 +478,29 @@ <reference key="object" ref="902501233"/> <reference key="parent" ref="1002"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">27</int> + <reference key="object" ref="110574594"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="876279762"/> + </object> + <reference key="parent" ref="1006"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">28</int> + <reference key="object" ref="876279762"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="481205052"/> + </object> + <reference key="parent" ref="110574594"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">29</int> + <reference key="object" ref="481205052"/> + <reference key="parent" ref="876279762"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -488,11 +519,12 @@ <string>11.IBPluginDependency</string> <string>12.IBPluginDependency</string> <string>13.IBPluginDependency</string> - <string>14.IBPluginDependency</string> - <string>15.IBPluginDependency</string> <string>17.IBPluginDependency</string> <string>19.IBPluginDependency</string> <string>2.IBPluginDependency</string> + <string>28.IBPluginDependency</string> + <string>29.CustomClassName</string> + <string>29.IBPluginDependency</string> <string>3.IBPluginDependency</string> <string>4.IBPluginDependency</string> <string>5.IBPluginDependency</string> @@ -505,9 +537,9 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{363, 406}, {480, 270}}</string> + <string>{{274, 515}, {480, 270}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{363, 406}, {480, 270}}</string> + <string>{{274, 515}, {480, 270}}</string> <integer value="1"/> <string>{196, 240}</string> <string>{{357, 418}, {480, 270}}</string> @@ -518,6 +550,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>HyperlinkButtonCell</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> @@ -547,7 +580,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">23</int> + <int key="maxID">30</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -627,6 +660,14 @@ <reference key="sourceIdentifier" ref="1070061944"/> </object> <object class="IBPartialClassDescription"> + <string key="className">HyperlinkButtonCell</string> + <string key="superclassName">NSButtonCell</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">browser/cocoa/hyperlink_button_cell.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBProjectSource</string> @@ -650,6 +691,10 @@ <object class="IBPartialClassDescription"> <string key="className">TaskManagerWindowController</string> <string key="superclassName">NSWindowController</string> + <object class="NSMutableDictionary" key="actions"> + <string key="NS.key.0">statsLinkClicked:</string> + <string key="NS.object.0">id</string> + </object> <object class="NSMutableDictionary" key="outlets"> <string key="NS.key.0">tableView_</string> <string key="NS.object.0">NSTableView</string> diff --git a/chrome/browser/cocoa/task_manager_mac.h b/chrome/browser/cocoa/task_manager_mac.h index 46d0455..2b8f961 100644 --- a/chrome/browser/cocoa/task_manager_mac.h +++ b/chrome/browser/cocoa/task_manager_mac.h @@ -22,6 +22,8 @@ // Refreshes all data in the task manager table. - (void)reloadData; + +- (IBAction)statsLinkClicked:(id)sender; @end // This class listens to task changed events sent by chrome. diff --git a/chrome/browser/cocoa/task_manager_mac.mm b/chrome/browser/cocoa/task_manager_mac.mm index a35128c..e5b1a04 100644 --- a/chrome/browser/cocoa/task_manager_mac.mm +++ b/chrome/browser/cocoa/task_manager_mac.mm @@ -13,7 +13,6 @@ #include "grit/generated_resources.h" // TODO(thakis): Autoremember window size/pos (and selected columns?) -// TODO(thakis): Link that opens about:memory // TODO(thakis): Activate button iff something is selected, hook it up // TODO(thakis): Column sort comparator // TODO(thakis): Clicking column header doesn't sort @@ -50,6 +49,10 @@ [tableView_ reloadData]; } +- (IBAction)statsLinkClicked:(id)sender { + TaskManager::GetInstance()->OpenAboutMemory(); +} + - (void)awakeFromNib { [self setUpTableColumns]; [self setUpTableHeaderContextMenu]; diff --git a/chrome/browser/gtk/task_manager_gtk.cc b/chrome/browser/gtk/task_manager_gtk.cc index 9854a3e..bc66dd7 100644 --- a/chrome/browser/gtk/task_manager_gtk.cc +++ b/chrome/browser/gtk/task_manager_gtk.cc @@ -24,7 +24,6 @@ #include "chrome/common/gtk_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/url_constants.h" #include "grit/app_resources.h" #include "grit/chromium_strings.h" @@ -663,20 +662,7 @@ void TaskManagerGtk::ActivateFocusedTab() { } void TaskManagerGtk::OnLinkActivated() { - Browser* browser = BrowserList::GetLastActive(); - DCHECK(browser); - browser->OpenURL(GURL(chrome::kAboutMemoryURL), GURL(), NEW_FOREGROUND_TAB, - PageTransition::LINK); - // In case the browser window is minimzed, show it. If this is an application - // or popup, we can only have one tab, hence we need to process this in a - // tabbed browser window. Currently, |browser| is pointing to the application, - // popup window. Therefore, we have to retrieve the last active tab again, - // since a new window has been used. - if (browser->type() & Browser::TYPE_APP_POPUP) { - browser = BrowserList::GetLastActive(); - DCHECK(browser); - } - browser->window()->Show(); + task_manager_->OpenAboutMemory(); } gint TaskManagerGtk::CompareImpl(GtkTreeModel* model, GtkTreeIter* a, diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc index 0af61ff..bbc77da 100644 --- a/chrome/browser/task_manager.cc +++ b/chrome/browser/task_manager.cc @@ -14,12 +14,14 @@ #include "base/thread.h" #include "chrome/browser/browser_list.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_window.h" #include "chrome/browser/net/url_request_tracking.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" #include "chrome/browser/task_manager_resource_providers.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" +#include "chrome/common/url_constants.h" #include "grit/app_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" @@ -820,3 +822,20 @@ void TaskManager::OnWindowClosed() { TaskManager* TaskManager::GetInstance() { return Singleton<TaskManager>::get(); } + +void TaskManager::OpenAboutMemory() { + Browser* browser = BrowserList::GetLastActive(); + DCHECK(browser); + browser->OpenURL(GURL(chrome::kAboutMemoryURL), GURL(), NEW_FOREGROUND_TAB, + PageTransition::LINK); + // In case the browser window is minimzed, show it. If this is an application + // or popup, we can only have one tab, hence we need to process this in a + // tabbed browser window. Currently, |browser| is pointing to the application, + // popup window. Therefore, we have to retrieve the last active tab again, + // since a new window has been used. + if (browser->type() & Browser::TYPE_APP_POPUP) { + browser = BrowserList::GetLastActive(); + DCHECK(browser); + } + browser->window()->Show(); +} diff --git a/chrome/browser/task_manager.h b/chrome/browser/task_manager.h index a4ece90..70c2644 100644 --- a/chrome/browser/task_manager.h +++ b/chrome/browser/task_manager.h @@ -125,6 +125,8 @@ class TaskManager { TaskManagerModel* model() const { return model_.get(); } + void OpenAboutMemory(); + private: FRIEND_TEST(TaskManagerTest, Basic); FRIEND_TEST(TaskManagerTest, Resources); diff --git a/chrome/browser/views/task_manager_view.cc b/chrome/browser/views/task_manager_view.cc index 2572cd0..36a477b 100644 --- a/chrome/browser/views/task_manager_view.cc +++ b/chrome/browser/views/task_manager_view.cc @@ -16,7 +16,6 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" -#include "chrome/common/url_constants.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" @@ -581,20 +580,7 @@ void TaskManagerView::OnKeyDown(unsigned short virtual_keycode) { // views::LinkController implementation void TaskManagerView::LinkActivated(views::Link* source, int event_flags) { DCHECK(source == about_memory_link_); - Browser* browser = BrowserList::GetLastActive(); - DCHECK(browser); - browser->OpenURL(GURL(chrome::kAboutMemoryURL), GURL(), NEW_FOREGROUND_TAB, - PageTransition::LINK); - // In case the browser window is minimzed, show it. If this is an application - // or popup, we can only have one tab, hence we need to process this in a - // tabbed browser window. Currently, |browser| is pointing to the application, - // popup window. Therefore, we have to retrieve the last active tab again, - // since a new window has been used. - if (browser->type() & Browser::TYPE_APP_POPUP) { - browser = BrowserList::GetLastActive(); - DCHECK(browser); - } - browser->window()->Show(); + task_manager_->OpenAboutMemory(); } void TaskManagerView::ShowContextMenu(views::View* source, int x, int y, |