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

Side by Side Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm

Issue 2695923008: Add a temporary crash key to debug nib loading issues. (Closed)
Patch Set: More accurate comment. Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/common/crash_keys.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
6 6
7 #include <sys/stat.h>
7 #include <algorithm> 8 #include <algorithm>
8 9
10 #include "base/debug/crash_logging.h"
9 #include "base/mac/bundle_locations.h" 11 #include "base/mac/bundle_locations.h"
10 #include "base/mac/foundation_util.h" 12 #include "base/mac/foundation_util.h"
11 #include "base/mac/mac_util.h" 13 #include "base/mac/mac_util.h"
12 #include "base/mac/sdk_forward_declarations.h" 14 #include "base/mac/sdk_forward_declarations.h"
13 #include "base/macros.h" 15 #include "base/macros.h"
14 #include "base/memory/singleton.h" 16 #include "base/memory/singleton.h"
15 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
16 #include "base/strings/sys_string_conversions.h" 18 #include "base/strings/sys_string_conversions.h"
17 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
18 #include "chrome/app/chrome_command_ids.h" 20 #include "chrome/app/chrome_command_ids.h"
(...skipping 26 matching lines...) Expand all
45 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button.h" 47 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button.h"
46 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button_cell.h" 48 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button_cell.h"
47 #import "chrome/browser/ui/cocoa/toolbar/back_forward_menu_controller.h" 49 #import "chrome/browser/ui/cocoa/toolbar/back_forward_menu_controller.h"
48 #import "chrome/browser/ui/cocoa/toolbar/reload_button_cocoa.h" 50 #import "chrome/browser/ui/cocoa/toolbar/reload_button_cocoa.h"
49 #import "chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.h" 51 #import "chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.h"
50 #import "chrome/browser/ui/cocoa/toolbar/toolbar_view_cocoa.h" 52 #import "chrome/browser/ui/cocoa/toolbar/toolbar_view_cocoa.h"
51 #import "chrome/browser/ui/cocoa/view_id_util.h" 53 #import "chrome/browser/ui/cocoa/view_id_util.h"
52 #include "chrome/browser/ui/tabs/tab_strip_model.h" 54 #include "chrome/browser/ui/tabs/tab_strip_model.h"
53 #include "chrome/browser/ui/toolbar/app_menu_icon_controller.h" 55 #include "chrome/browser/ui/toolbar/app_menu_icon_controller.h"
54 #include "chrome/browser/ui/toolbar/app_menu_model.h" 56 #include "chrome/browser/ui/toolbar/app_menu_model.h"
57 #include "chrome/common/crash_keys.h"
55 #include "chrome/common/pref_names.h" 58 #include "chrome/common/pref_names.h"
56 #include "chrome/grit/chromium_strings.h" 59 #include "chrome/grit/chromium_strings.h"
57 #include "chrome/grit/generated_resources.h" 60 #include "chrome/grit/generated_resources.h"
58 #include "chrome/grit/theme_resources.h" 61 #include "chrome/grit/theme_resources.h"
59 #include "components/metrics/proto/omnibox_event.pb.h" 62 #include "components/metrics/proto/omnibox_event.pb.h"
60 #include "components/omnibox/browser/autocomplete_classifier.h" 63 #include "components/omnibox/browser/autocomplete_classifier.h"
61 #include "components/omnibox/browser/autocomplete_match.h" 64 #include "components/omnibox/browser/autocomplete_match.h"
62 #include "components/omnibox/browser/omnibox_edit_model.h" 65 #include "components/omnibox/browser/omnibox_edit_model.h"
63 #include "components/omnibox/browser/omnibox_view.h" 66 #include "components/omnibox/browser/omnibox_view.h"
64 #include "components/prefs/pref_service.h" 67 #include "components/prefs/pref_service.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // Now we can hook up bridges that rely on UI objects such as the location bar 248 // Now we can hook up bridges that rely on UI objects such as the location bar
246 // and button state. -viewDidLoad is the recommended way to do this in 10.10 249 // and button state. -viewDidLoad is the recommended way to do this in 10.10
247 // SDK. When running on 10.10 or above -awakeFromNib still works but for some 250 // SDK. When running on 10.10 or above -awakeFromNib still works but for some
248 // reason is not guaranteed to be called (http://crbug.com/526276), so implement 251 // reason is not guaranteed to be called (http://crbug.com/526276), so implement
249 // both. 252 // both.
250 - (void)awakeFromNib { 253 - (void)awakeFromNib {
251 [self viewDidLoad]; 254 [self viewDidLoad];
252 } 255 }
253 256
254 - (void)viewDidLoad { 257 - (void)viewDidLoad {
258 // Temporary: collect information about a potentially missing or inaccessible
259 // nib (https://crbug.com/685985)
260 NSString* nibPath = [self.nibBundle pathForResource:@"Toolbar" ofType:@"nib"];
261 struct stat sb;
262 int nibErrno = 0;
263 if (stat(nibPath.fileSystemRepresentation, &sb) != 0) {
264 nibErrno = errno;
265 }
266 NSString* closestPath = nibPath;
267 while (closestPath && stat(closestPath.fileSystemRepresentation, &sb) != 0) {
268 closestPath = [closestPath stringByDeletingLastPathComponent];
269 }
270 base::debug::ScopedCrashKey nibCrashKey {
271 crash_keys::mac::kToolbarNibInfo,
272 [NSString stringWithFormat:@"errno: %d nib: %@ closest: %@", nibErrno,
273 nibPath, closestPath]
274 .UTF8String
275 };
276
255 // When linking and running on 10.10+, both -awakeFromNib and -viewDidLoad may 277 // When linking and running on 10.10+, both -awakeFromNib and -viewDidLoad may
256 // be called, don't initialize twice. 278 // be called, don't initialize twice.
257 if (locationBarView_) { 279 if (locationBarView_) {
258 DCHECK(base::mac::IsAtLeastOS10_10()); 280 DCHECK(base::mac::IsAtLeastOS10_10());
259 return; 281 return;
260 } 282 }
261 283
262 BOOL isRTL = cocoa_l10n_util::ShouldDoExperimentalRTLLayout(); 284 BOOL isRTL = cocoa_l10n_util::ShouldDoExperimentalRTLLayout();
263 NSAutoresizingMaskOptions leadingButtonMask = 285 NSAutoresizingMaskOptions leadingButtonMask =
264 isRTL ? NSViewMinXMargin | NSViewMinYMargin 286 isRTL ? NSViewMinXMargin | NSViewMinYMargin
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 - (void)hideDropURLsIndicatorInView:(NSView*)view { 1107 - (void)hideDropURLsIndicatorInView:(NSView*)view {
1086 // Do nothing. 1108 // Do nothing.
1087 } 1109 }
1088 1110
1089 // (URLDropTargetController protocol) 1111 // (URLDropTargetController protocol)
1090 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { 1112 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info {
1091 return drag_util::IsUnsupportedDropData(profile_, info); 1113 return drag_util::IsUnsupportedDropData(profile_, info);
1092 } 1114 }
1093 1115
1094 @end 1116 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/common/crash_keys.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698