Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(871)

Unified Diff: chrome/browser/cocoa/toolbar_controller.mm

Issue 2878037: [Mac]Implement ViewID support. (third approach) (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Update according to review feedback. Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/tab_view.mm ('k') | chrome/browser/cocoa/toolbar_view.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/toolbar_controller.mm
diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm
index 66010bd2f94fe82094482d9205a796906654e56f..968705a723485cd7dec16d3ab61c9a50ec4f61c2 100644
--- a/chrome/browser/cocoa/toolbar_controller.mm
+++ b/chrome/browser/cocoa/toolbar_controller.mm
@@ -33,6 +33,7 @@
#import "chrome/browser/cocoa/menu_controller.h"
#import "chrome/browser/cocoa/reload_button.h"
#import "chrome/browser/cocoa/toolbar_view.h"
+#import "chrome/browser/cocoa/view_id_util.h"
#import "chrome/browser/cocoa/wrench_menu_controller.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/pref_service.h"
@@ -225,6 +226,14 @@ class NotificationBridge : public NotificationObserver {
- (void)dealloc {
+ // Unset ViewIDs of toolbar elements.
+ // ViewIDs of |toolbarView|, |reloadButton_|, |locationBar_| and
+ // |browserActionsContainerView_| are handled by themselves.
+ view_id_util::UnsetID(backButton_);
+ view_id_util::UnsetID(forwardButton_);
+ view_id_util::UnsetID(homeButton_);
+ view_id_util::UnsetID(wrenchButton_);
+
// Make sure any code in the base class which assumes [self view] is
// the "parent" view continues to work.
hasToolbar_ = YES;
@@ -323,6 +332,14 @@ class NotificationBridge : public NotificationObserver {
selector:@selector(toolbarFrameChanged)
name:NSViewFrameDidChangeNotification
object:toolbarView];
+
+ // Set ViewIDs for toolbar elements which don't have their dedicated class.
+ // ViewIDs of |toolbarView|, |reloadButton_|, |locationBar_| and
+ // |browserActionsContainerView_| are handled by themselves.
+ view_id_util::SetID(backButton_, VIEW_ID_BACK_BUTTON);
+ view_id_util::SetID(forwardButton_, VIEW_ID_FORWARD_BUTTON);
+ view_id_util::SetID(homeButton_, VIEW_ID_HOME_BUTTON);
+ view_id_util::SetID(wrenchButton_, VIEW_ID_APP_MENU);
}
- (void)addAccessibilityDescriptions {
« no previous file with comments | « chrome/browser/cocoa/tab_view.mm ('k') | chrome/browser/cocoa/toolbar_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698