| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/cocoa/tab_contents_controller.h" | 5 #include "chrome/browser/cocoa/tab_contents_controller.h" |
| 6 | 6 |
| 7 #import "base/sys_string_conversions.h" | 7 #import "base/sys_string_conversions.h" |
| 8 #import "chrome/app/chrome_dll_resource.h" | 8 #import "chrome/app/chrome_dll_resource.h" |
| 9 #import "chrome/browser/command_updater.h" | 9 #import "chrome/browser/command_updater.h" |
| 10 #import "chrome/browser/location_bar.h" | 10 #import "chrome/browser/location_bar.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 - (id)initWithNibName:(NSString*)name | 69 - (id)initWithNibName:(NSString*)name |
| 70 bundle:(NSBundle*)bundle | 70 bundle:(NSBundle*)bundle |
| 71 contents:(TabContents*)contents | 71 contents:(TabContents*)contents |
| 72 commands:(CommandUpdater*)commands { | 72 commands:(CommandUpdater*)commands { |
| 73 if ((self = [super initWithNibName:name bundle:bundle])) { | 73 if ((self = [super initWithNibName:name bundle:bundle])) { |
| 74 commands_ = commands; | 74 commands_ = commands; |
| 75 if (commands_) | 75 if (commands_) |
| 76 observer_ = new TabContentsCommandObserver(self, commands); | 76 observer_ = new TabContentsCommandObserver(self, commands); |
| 77 locationBarBridge_ = new LocationBarBridge(self); | 77 locationBarBridge_ = new LocationBarBridge(self); |
| 78 [contentsBox_ setContentView:contents->GetNativeView()]; | 78 contents_ = contents; |
| 79 } | 79 } |
| 80 return self; | 80 return self; |
| 81 } | 81 } |
| 82 | 82 |
| 83 - (void)dealloc { | 83 - (void)dealloc { |
| 84 // make sure our contents have been removed from the window | 84 // make sure our contents have been removed from the window |
| 85 [[self view] removeFromSuperview]; | 85 [[self view] removeFromSuperview]; |
| 86 delete observer_; | 86 delete observer_; |
| 87 delete locationBarBridge_; | 87 delete locationBarBridge_; |
| 88 [super dealloc]; | 88 [super dealloc]; |
| 89 } | 89 } |
| 90 | 90 |
| 91 - (void)awakeFromNib { | 91 - (void)awakeFromNib { |
| 92 [contentsBox_ setContentView:contents_->GetNativeView()]; |
| 93 |
| 92 // Provide a starting point since we won't get notifications if the state | 94 // Provide a starting point since we won't get notifications if the state |
| 93 // doesn't change between tabs. | 95 // doesn't change between tabs. |
| 94 [self updateToolbarCommandStatus]; | 96 [self updateToolbarCommandStatus]; |
| 95 | 97 |
| 96 [locationBar_ setStringValue:@"http://dev.chromium.org"]; | 98 [locationBar_ setStringValue:@"http://dev.chromium.org"]; |
| 97 } | 99 } |
| 98 | 100 |
| 99 - (LocationBar*)locationBar { | 101 - (LocationBar*)locationBar { |
| 100 return locationBarBridge_; | 102 return locationBarBridge_; |
| 101 } | 103 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 205 |
| 204 std::wstring LocationBarBridge::GetInputString() const { | 206 std::wstring LocationBarBridge::GetInputString() const { |
| 205 return base::SysNSStringToWide([controller_ locationBarString]); | 207 return base::SysNSStringToWide([controller_ locationBarString]); |
| 206 } | 208 } |
| 207 | 209 |
| 208 void LocationBarBridge::FocusLocation() { | 210 void LocationBarBridge::FocusLocation() { |
| 209 [controller_ focusLocationBar]; | 211 [controller_ focusLocationBar]; |
| 210 } | 212 } |
| 211 | 213 |
| 212 | 214 |
| OLD | NEW |