summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-11 21:56:58 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-11 21:56:58 +0000
commita4be1e85d6c73aea61d1c5b118d9804b1a8ca4f8 (patch)
tree4a2dd47cf3955e32839700f04a281e5cb742653f /chrome/browser/cocoa
parentdbcb6d7712e923327e327b6fea5acf941d444fba (diff)
downloadchromium_src-a4be1e85d6c73aea61d1c5b118d9804b1a8ca4f8.zip
chromium_src-a4be1e85d6c73aea61d1c5b118d9804b1a8ca4f8.tar.gz
chromium_src-a4be1e85d6c73aea61d1c5b118d9804b1a8ca4f8.tar.bz2
Implement more of the TabContentsDelegate to hook up loading URLs from the location bar where there is UI to do so.
Review URL: http://codereview.chromium.org/21264 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9601 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/tab_contents_controller.mm32
1 files changed, 29 insertions, 3 deletions
diff --git a/chrome/browser/cocoa/tab_contents_controller.mm b/chrome/browser/cocoa/tab_contents_controller.mm
index ebcb3d7..31948ec 100644
--- a/chrome/browser/cocoa/tab_contents_controller.mm
+++ b/chrome/browser/cocoa/tab_contents_controller.mm
@@ -4,6 +4,7 @@
#include "chrome/browser/cocoa/tab_contents_controller.h"
+#import "base/sys_string_conversions.h"
#import "chrome/app/chrome_dll_resource.h"
#import "chrome/browser/command_updater.h"
#import "chrome/browser/location_bar.h"
@@ -15,6 +16,11 @@
- (void)enabledStateChangedForCommand:(NSInteger)command enabled:(BOOL)enabled;
@end
+@interface TabContentsController(LocationBar)
+- (NSString*)locationBarString;
+- (void)focusLocationBar;
+@end
+
@interface TabContentsController(Private)
- (void)updateToolbarCommandStatus;
@end
@@ -35,20 +41,22 @@ class TabContentsCommandObserver : public CommandUpdater::CommandObserver {
CommandUpdater* commands_; // weak
};
-// TODO(pinkerton): implement these
+// A C++ bridge class that handles responding to requests from the
+// cross-platform code for information about the location bar. Just passes
+// everything back to the controller.
class LocationBarBridge : public LocationBar {
public:
LocationBarBridge(TabContentsController* controller);
// Overridden from LocationBar
virtual void ShowFirstRunBubble() { NOTIMPLEMENTED(); }
- virtual std::wstring GetInputString() const { NOTIMPLEMENTED(); return L""; }
+ virtual std::wstring GetInputString() const;
virtual WindowOpenDisposition GetWindowOpenDisposition() const
{ NOTIMPLEMENTED(); return NEW_FOREGROUND_TAB; }
virtual PageTransition::Type GetPageTransition() const
{ NOTIMPLEMENTED(); return 0; }
virtual void AcceptInput() { NOTIMPLEMENTED(); }
- virtual void FocusLocation() { NOTIMPLEMENTED(); }
+ virtual void FocusLocation();
virtual void FocusSearch() { NOTIMPLEMENTED(); }
virtual void SaveStateToContents(TabContents* contents) { NOTIMPLEMENTED(); }
@@ -152,6 +160,14 @@ class LocationBarBridge : public LocationBar {
[self updateToolbarCommandStatus];
}
+- (NSString*)locationBarString {
+ return [locationBar_ stringValue];
+}
+
+- (void)focusLocationBar {
+ [[locationBar_ window] makeFirstResponder:locationBar_];
+}
+
@end
//--------------------------------------------------------------------------
@@ -184,3 +200,13 @@ void TabContentsCommandObserver::EnabledStateChangedForCommand(int command,
LocationBarBridge::LocationBarBridge(TabContentsController* controller)
: controller_(controller) {
}
+
+std::wstring LocationBarBridge::GetInputString() const {
+ return base::SysNSStringToWide([controller_ locationBarString]);
+}
+
+void LocationBarBridge::FocusLocation() {
+ [controller_ focusLocationBar];
+}
+
+