| 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 #ifndef CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ | 5 #ifndef CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ |
| 6 #define CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ | 6 #define CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #import <Cocoa/Cocoa.h> | 12 #import <Cocoa/Cocoa.h> |
| 13 | 13 |
| 14 #include "base/scoped_nsobject.h" | 14 #include "base/scoped_nsobject.h" |
| 15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
| 16 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 16 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 17 #include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h" | 17 #include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h" |
| 18 #include "chrome/browser/extensions/image_loading_tracker.h" | 18 #include "chrome/browser/extensions/image_loading_tracker.h" |
| 19 #include "chrome/browser/location_bar.h" | 19 #include "chrome/browser/location_bar.h" |
| 20 #include "chrome/browser/toolbar_model.h" | 20 #include "chrome/browser/toolbar_model.h" |
| 21 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
| 22 | 22 |
| 23 @class AutocompleteTextField; | 23 @class AutocompleteTextField; |
| 24 class BubblePositioner; | 24 class BubblePositioner; |
| 25 class CommandUpdater; | 25 class CommandUpdater; |
| 26 @class ExtensionPopupController; |
| 26 class Profile; | 27 class Profile; |
| 27 class ToolbarModel; | 28 class ToolbarModel; |
| 28 | 29 |
| 29 // A C++ bridge class that represents the location bar UI element to | 30 // A C++ bridge class that represents the location bar UI element to |
| 30 // the portable code. Wires up an AutocompleteEditViewMac instance to | 31 // the portable code. Wires up an AutocompleteEditViewMac instance to |
| 31 // the location bar text field, which handles most of the work. | 32 // the location bar text field, which handles most of the work. |
| 32 | 33 |
| 33 class LocationBarViewMac : public AutocompleteEditController, | 34 class LocationBarViewMac : public AutocompleteEditController, |
| 34 public LocationBar, | 35 public LocationBar, |
| 35 public LocationBarTesting { | 36 public LocationBarTesting { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 PageTransition::Type transition, | 77 PageTransition::Type transition, |
| 77 const GURL& alternate_nav_url); | 78 const GURL& alternate_nav_url); |
| 78 virtual void OnChanged(); | 79 virtual void OnChanged(); |
| 79 virtual void OnInputInProgress(bool in_progress); | 80 virtual void OnInputInProgress(bool in_progress); |
| 80 virtual void OnKillFocus(); | 81 virtual void OnKillFocus(); |
| 81 virtual void OnSetFocus(); | 82 virtual void OnSetFocus(); |
| 82 virtual SkBitmap GetFavIcon() const; | 83 virtual SkBitmap GetFavIcon() const; |
| 83 virtual std::wstring GetTitle() const; | 84 virtual std::wstring GetTitle() const; |
| 84 | 85 |
| 85 NSImage* GetTabButtonImage(); | 86 NSImage* GetTabButtonImage(); |
| 87 AutocompleteTextField* GetAutocompleteTextField() { return field_; } |
| 86 | 88 |
| 87 // Internals of OnChanged(), pulled out for purposes of unit | 89 // Internals of OnChanged(), pulled out for purposes of unit |
| 88 // testing. Sets up |field| based on the parameters, which are | 90 // testing. Sets up |field| based on the parameters, which are |
| 89 // pulled from edit_view->model(). | 91 // pulled from edit_view->model(). |
| 90 static void OnChangedImpl(AutocompleteTextField* field, | 92 static void OnChangedImpl(AutocompleteTextField* field, |
| 91 const std::wstring& keyword, | 93 const std::wstring& keyword, |
| 92 const std::wstring& short_name, | 94 const std::wstring& short_name, |
| 93 const bool is_keyword_hint, | 95 const bool is_keyword_hint, |
| 94 const bool show_search_hint, | 96 const bool show_search_hint, |
| 95 NSImage* image); | 97 NSImage* image); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 page_action_(NULL), | 202 page_action_(NULL), |
| 201 tracker_(NULL), | 203 tracker_(NULL), |
| 202 current_tab_id_(-1), | 204 current_tab_id_(-1), |
| 203 preview_enabled_(false) {} | 205 preview_enabled_(false) {} |
| 204 | 206 |
| 205 private: | 207 private: |
| 206 // Overridden from NotificationObserver: | 208 // Overridden from NotificationObserver: |
| 207 virtual void Observe(NotificationType type, | 209 virtual void Observe(NotificationType type, |
| 208 const NotificationSource& source, | 210 const NotificationSource& source, |
| 209 const NotificationDetails& details); | 211 const NotificationDetails& details); |
| 212 void HidePopup(); |
| 210 | 213 |
| 211 // The location bar view that owns us. | 214 // The location bar view that owns us. |
| 212 LocationBarViewMac* owner_; | 215 LocationBarViewMac* owner_; |
| 213 | 216 |
| 214 // The current profile (not owned by us). | 217 // The current profile (not owned by us). |
| 215 Profile* profile_; | 218 Profile* profile_; |
| 216 | 219 |
| 217 // The Page Action that this view represents. The Page Action is not owned | 220 // The Page Action that this view represents. The Page Action is not owned |
| 218 // by us, it resides in the extension of this particular profile. | 221 // by us, it resides in the extension of this particular profile. |
| 219 ExtensionAction* page_action_; | 222 ExtensionAction* page_action_; |
| 220 | 223 |
| 221 // A cache of images the Page Actions might need to show, mapped by path. | 224 // A cache of images the Page Actions might need to show, mapped by path. |
| 222 typedef std::map<std::string, SkBitmap> PageActionMap; | 225 typedef std::map<std::string, SkBitmap> PageActionMap; |
| 223 PageActionMap page_action_icons_; | 226 PageActionMap page_action_icons_; |
| 224 | 227 |
| 228 // The controller for the popup displayed if a page action has one. Weak. |
| 229 ExtensionPopupController* popupController_; |
| 230 |
| 225 // The object that is waiting for the image loading to complete | 231 // The object that is waiting for the image loading to complete |
| 226 // asynchronously. | 232 // asynchronously. |
| 227 ImageLoadingTracker* tracker_; | 233 ImageLoadingTracker* tracker_; |
| 228 | 234 |
| 229 // The tab id we are currently showing the icon for. | 235 // The tab id we are currently showing the icon for. |
| 230 int current_tab_id_; | 236 int current_tab_id_; |
| 231 | 237 |
| 232 // The URL we are currently showing the icon for. | 238 // The URL we are currently showing the icon for. |
| 233 GURL current_url_; | 239 GURL current_url_; |
| 234 | 240 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // Image used in drawing keyword hint. | 321 // Image used in drawing keyword hint. |
| 316 scoped_nsobject<NSImage> tab_button_image_; | 322 scoped_nsobject<NSImage> tab_button_image_; |
| 317 | 323 |
| 318 // The transition type to use for the navigation. | 324 // The transition type to use for the navigation. |
| 319 PageTransition::Type transition_; | 325 PageTransition::Type transition_; |
| 320 | 326 |
| 321 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 327 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
| 322 }; | 328 }; |
| 323 | 329 |
| 324 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ | 330 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ |
| OLD | NEW |