OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 // download shelf was a ChromeView attached to the TabContents, and as its | 196 // download shelf was a ChromeView attached to the TabContents, and as its |
197 // size changed via animation it notified through TCD/etc to the browser view | 197 // size changed via animation it notified through TCD/etc to the browser view |
198 // to relayout for each tick of the animation. We don't need anything of the | 198 // to relayout for each tick of the animation. We don't need anything of the |
199 // sort on Mac. | 199 // sort on Mac. |
200 } | 200 } |
201 | 201 |
202 void BrowserWindowCocoa::UpdateTitleBar() { | 202 void BrowserWindowCocoa::UpdateTitleBar() { |
203 NSString* newTitle = | 203 NSString* newTitle = |
204 base::SysUTF16ToNSString(browser_->GetWindowTitleForCurrentTab()); | 204 base::SysUTF16ToNSString(browser_->GetWindowTitleForCurrentTab()); |
205 | 205 |
206 // Work around Cocoa bug: if a window changes title during the tracking of the | 206 [BrowserWindowUtils delayedReplace:pending_window_title_.get() |
Dmitry Titov
2011/08/31 01:01:30
Naming suggestion: Usually 'delayedFoo' is associa
dcheng
2011/08/31 23:58:03
Done. Now with a longer more verbose name.
| |
207 // Window menu it doesn't display well and the constant re-sorting of the list | 207 with:newTitle |
208 // makes it difficult for the user to pick the desired window. Delay window | 208 on:window()]; |
209 // title updates until the default run-loop mode. | |
210 | |
211 if (pending_window_title_.get()) | |
212 [[NSRunLoop currentRunLoop] | |
213 cancelPerformSelector:@selector(setTitle:) | |
214 target:window() | |
215 argument:pending_window_title_.get()]; | |
216 | |
217 pending_window_title_.reset([newTitle copy]); | |
218 [[NSRunLoop currentRunLoop] | |
219 performSelector:@selector(setTitle:) | |
220 target:window() | |
221 argument:newTitle | |
222 order:0 | |
223 modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]]; | |
224 } | 209 } |
225 | 210 |
226 void BrowserWindowCocoa::BookmarkBarStateChanged( | 211 void BrowserWindowCocoa::BookmarkBarStateChanged( |
227 BookmarkBar::AnimateChangeType change_type) { | 212 BookmarkBar::AnimateChangeType change_type) { |
228 // TODO: route changes to state through this. | 213 // TODO: route changes to state through this. |
229 } | 214 } |
230 | 215 |
231 void BrowserWindowCocoa::UpdateDevTools() { | 216 void BrowserWindowCocoa::UpdateDevTools() { |
232 [controller_ updateDevToolsForContents: | 217 [controller_ updateDevToolsForContents: |
233 browser_->GetSelectedTabContents()]; | 218 browser_->GetSelectedTabContents()]; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
578 | 563 |
579 NSWindow* BrowserWindowCocoa::window() const { | 564 NSWindow* BrowserWindowCocoa::window() const { |
580 return [controller_ window]; | 565 return [controller_ window]; |
581 } | 566 } |
582 | 567 |
583 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { | 568 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { |
584 if (tab_contents == browser_->GetSelectedTabContents()) { | 569 if (tab_contents == browser_->GetSelectedTabContents()) { |
585 [controller_ updateSidebarForContents:tab_contents]; | 570 [controller_ updateSidebarForContents:tab_contents]; |
586 } | 571 } |
587 } | 572 } |
OLD | NEW |