| 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 #import <Carbon/Carbon.h> | 5 #import <Carbon/Carbon.h> |
| 6 | 6 |
| 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" | 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/browser/browser_shutdown.h" |
| 11 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat
e.h" | 12 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat
e.h" |
| 12 #include "chrome/browser/tab_contents/popup_menu_helper_mac.h" | 13 #include "chrome/browser/tab_contents/popup_menu_helper_mac.h" |
| 13 #include "chrome/browser/tab_contents/render_view_context_menu_mac.h" | 14 #include "chrome/browser/tab_contents/render_view_context_menu_mac.h" |
| 14 #import "chrome/browser/ui/cocoa/focus_tracker.h" | 15 #import "chrome/browser/ui/cocoa/focus_tracker.h" |
| 15 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" | 16 #import "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" |
| 16 #import "chrome/browser/ui/cocoa/tab_contents/web_drag_source.h" | 17 #import "chrome/browser/ui/cocoa/tab_contents/web_drag_source.h" |
| 17 #import "chrome/browser/ui/cocoa/tab_contents/web_drop_target.h" | 18 #import "chrome/browser/ui/cocoa/tab_contents/web_drop_target.h" |
| 18 #import "chrome/browser/ui/cocoa/view_id_util.h" | 19 #import "chrome/browser/ui/cocoa/view_id_util.h" |
| 19 #include "content/browser/renderer_host/render_view_host.h" | 20 #include "content/browser/renderer_host/render_view_host.h" |
| 20 #include "content/browser/renderer_host/render_view_host_factory.h" | 21 #include "content/browser/renderer_host/render_view_host_factory.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // when the "zoom" button in the browser window is clicked. | 177 // when the "zoom" button in the browser window is clicked. |
| 177 host->EnablePreferredSizeMode(kPreferredSizeWidth); | 178 host->EnablePreferredSizeMode(kPreferredSizeWidth); |
| 178 } | 179 } |
| 179 | 180 |
| 180 void TabContentsViewMac::SetPageTitle(const string16& title) { | 181 void TabContentsViewMac::SetPageTitle(const string16& title) { |
| 181 // Meaningless on the Mac; widgets don't have a "title" attribute | 182 // Meaningless on the Mac; widgets don't have a "title" attribute |
| 182 } | 183 } |
| 183 | 184 |
| 184 void TabContentsViewMac::OnTabCrashed(base::TerminationStatus /* status */, | 185 void TabContentsViewMac::OnTabCrashed(base::TerminationStatus /* status */, |
| 185 int /* error_code */) { | 186 int /* error_code */) { |
| 187 // Only show the sad tab if we're not in browser shutdown, so that TabContents |
| 188 // objects that are not in a browser (e.g., HTML dialogs) and thus are |
| 189 // visible do not flash a sad tab page. |
| 190 if (browser_shutdown::GetShutdownType() != browser_shutdown::NOT_VALID) |
| 191 return; |
| 192 |
| 186 if (!sad_tab_.get()) { | 193 if (!sad_tab_.get()) { |
| 187 DCHECK(tab_contents_); | 194 DCHECK(tab_contents_); |
| 188 if (tab_contents_) { | 195 if (tab_contents_) { |
| 189 SadTabController* sad_tab = | 196 SadTabController* sad_tab = |
| 190 [[SadTabController alloc] initWithTabContents:tab_contents_ | 197 [[SadTabController alloc] initWithTabContents:tab_contents_ |
| 191 superview:cocoa_view_]; | 198 superview:cocoa_view_]; |
| 192 sad_tab_.reset(sad_tab); | 199 sad_tab_.reset(sad_tab); |
| 193 } | 200 } |
| 194 } | 201 } |
| 195 } | 202 } |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 [[[notification userInfo] objectForKey:kSelectionDirection] | 583 [[[notification userInfo] objectForKey:kSelectionDirection] |
| 577 unsignedIntegerValue]; | 584 unsignedIntegerValue]; |
| 578 if (direction == NSDirectSelection) | 585 if (direction == NSDirectSelection) |
| 579 return; | 586 return; |
| 580 | 587 |
| 581 [self tabContents]-> | 588 [self tabContents]-> |
| 582 FocusThroughTabTraversal(direction == NSSelectingPrevious); | 589 FocusThroughTabTraversal(direction == NSSelectingPrevious); |
| 583 } | 590 } |
| 584 | 591 |
| 585 @end | 592 @end |
| OLD | NEW |