OLD | NEW |
---|---|
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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "chrome/app/vector_icons/vector_icons.h" | |
10 #include "chrome/browser/ui/browser_finder.h" | 11 #include "chrome/browser/ui/browser_finder.h" |
11 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
12 #include "chrome/browser/ui/cocoa/browser_window_controller.h" | 13 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
13 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" | 14 #import "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" |
14 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" | 15 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" |
15 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field.h" | 16 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field.h" |
16 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field_cell.h" | 17 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field_cell.h" |
17 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 18 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
18 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 19 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
19 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 20 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
20 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 21 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
21 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
22 #include "chrome/grit/theme_resources.h" | 23 #include "chrome/grit/theme_resources.h" |
23 #include "components/strings/grit/components_strings.h" | 24 #include "components/strings/grit/components_strings.h" |
24 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
25 #include "content/public/browser/render_widget_host.h" | 26 #include "content/public/browser/render_widget_host.h" |
26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
27 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h " | 28 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h " |
28 #import "ui/base/cocoa/find_pasteboard.h" | 29 #import "ui/base/cocoa/find_pasteboard.h" |
29 #import "ui/base/cocoa/focus_tracker.h" | 30 #import "ui/base/cocoa/focus_tracker.h" |
30 #import "ui/base/cocoa/nsview_additions.h" | 31 #import "ui/base/cocoa/nsview_additions.h" |
31 #include "ui/base/l10n/l10n_util_mac.h" | 32 #include "ui/base/l10n/l10n_util_mac.h" |
32 #include "ui/base/resource/resource_bundle.h" | 33 #include "ui/base/resource/resource_bundle.h" |
33 #include "ui/gfx/image/image_skia_util_mac.h" | 34 #include "ui/gfx/image/image_skia_util_mac.h" |
34 #include "ui/gfx/paint_vector_icon.h" | 35 #include "ui/gfx/paint_vector_icon.h" |
35 #include "ui/gfx/vector_icons_public.h" | |
36 #include "ui/resources/grit/ui_resources.h" | 36 #include "ui/resources/grit/ui_resources.h" |
37 | 37 |
38 using content::NativeWebKeyboardEvent; | 38 using content::NativeWebKeyboardEvent; |
39 | 39 |
40 const float kFindBarOpenDuration = 0.2; | 40 const float kFindBarOpenDuration = 0.2; |
41 const float kFindBarCloseDuration = 0.15; | 41 const float kFindBarCloseDuration = 0.15; |
42 const float kFindBarMoveDuration = 0.15; | 42 const float kFindBarMoveDuration = 0.15; |
43 const float kRightEdgeOffset = 25; | 43 const float kRightEdgeOffset = 25; |
44 | 44 |
45 | 45 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 IDS_FIND_IN_PAGE_CLOSE_TOOLTIP)]; | 127 IDS_FIND_IN_PAGE_CLOSE_TOOLTIP)]; |
128 [previousButton_ setToolTip:l10n_util::GetNSString( | 128 [previousButton_ setToolTip:l10n_util::GetNSString( |
129 IDS_FIND_IN_PAGE_PREVIOUS_TOOLTIP)]; | 129 IDS_FIND_IN_PAGE_PREVIOUS_TOOLTIP)]; |
130 [nextButton_ setToolTip:l10n_util::GetNSString( | 130 [nextButton_ setToolTip:l10n_util::GetNSString( |
131 IDS_FIND_IN_PAGE_NEXT_TOOLTIP)]; | 131 IDS_FIND_IN_PAGE_NEXT_TOOLTIP)]; |
132 | 132 |
133 [closeButton_ setTitle:l10n_util::GetNSString(IDS_ACCNAME_CLOSE)]; | 133 [closeButton_ setTitle:l10n_util::GetNSString(IDS_ACCNAME_CLOSE)]; |
134 [previousButton_ setTitle:l10n_util::GetNSString(IDS_ACCNAME_PREVIOUS)]; | 134 [previousButton_ setTitle:l10n_util::GetNSString(IDS_ACCNAME_PREVIOUS)]; |
135 [nextButton_ setTitle:l10n_util::GetNSString(IDS_ACCNAME_NEXT)]; | 135 [nextButton_ setTitle:l10n_util::GetNSString(IDS_ACCNAME_NEXT)]; |
136 | 136 |
137 NSImage* image = NSImageFromImageSkia( | 137 NSImage* image = |
138 gfx::CreateVectorIcon(gfx::VectorIconId::FIND_NEXT, SK_ColorBLACK)); | 138 NSImageFromImageSkia(gfx::CreateVectorIcon(kFindNext, SK_ColorBLACK)); |
sky
2017/01/12 16:21:34
Shouldn't this and the next be kCaretDown and kCar
Evan Stade
2017/01/12 16:29:47
yes. Bit of a brain fart. It's rare that I post a
| |
139 [image setTemplate:YES]; | 139 [image setTemplate:YES]; |
140 [nextButton_ setImage:image]; | 140 [nextButton_ setImage:image]; |
141 | 141 |
142 image = NSImageFromImageSkia( | 142 image = NSImageFromImageSkia(gfx::CreateVectorIcon(kFindPrev, SK_ColorBLACK)); |
143 gfx::CreateVectorIcon(gfx::VectorIconId::FIND_PREV, SK_ColorBLACK)); | |
144 [image setTemplate:YES]; | 143 [image setTemplate:YES]; |
145 [previousButton_ setImage:image]; | 144 [previousButton_ setImage:image]; |
146 | 145 |
147 [findBarView_ setFrame:[self hiddenFindBarFrame]]; | 146 [findBarView_ setFrame:[self hiddenFindBarFrame]]; |
148 defaultWidth_ = NSWidth([findBarView_ frame]); | 147 defaultWidth_ = NSWidth([findBarView_ frame]); |
149 [[self view] setHidden:YES]; | 148 [[self view] setHidden:YES]; |
150 | 149 |
151 [self prepopulateText:[[FindPasteboard sharedInstance] findText]]; | 150 [self prepopulateText:[[FindPasteboard sharedInstance] findText]]; |
152 } | 151 } |
153 | 152 |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
657 } | 656 } |
658 | 657 |
659 - (BrowserWindowController*)browserWindowController { | 658 - (BrowserWindowController*)browserWindowController { |
660 if (!browser_) | 659 if (!browser_) |
661 return nil; | 660 return nil; |
662 return [BrowserWindowController | 661 return [BrowserWindowController |
663 browserWindowControllerForWindow:browser_->window()->GetNativeWindow()]; | 662 browserWindowControllerForWindow:browser_->window()->GetNativeWindow()]; |
664 } | 663 } |
665 | 664 |
666 @end | 665 @end |
OLD | NEW |