| 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_VIEWS_LOCATION_BAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 DISALLOW_COPY_AND_ASSIGN(KeywordHintView); | 251 DISALLOW_COPY_AND_ASSIGN(KeywordHintView); |
| 252 }; | 252 }; |
| 253 | 253 |
| 254 | 254 |
| 255 class ShowInfoBubbleTask; | 255 class ShowInfoBubbleTask; |
| 256 class ShowFirstRunBubbleTask; | 256 class ShowFirstRunBubbleTask; |
| 257 | 257 |
| 258 class LocationBarImageView : public views::ImageView, | 258 class LocationBarImageView : public views::ImageView, |
| 259 public InfoBubbleDelegate { | 259 public InfoBubbleDelegate { |
| 260 public: | 260 public: |
| 261 LocationBarImageView(); | 261 explicit LocationBarImageView(const BubblePositioner* bubble_positioner); |
| 262 virtual ~LocationBarImageView(); | 262 virtual ~LocationBarImageView(); |
| 263 | 263 |
| 264 // Overridden from view for the mouse hovering. | 264 // Overridden from view for the mouse hovering. |
| 265 virtual void OnMouseMoved(const views::MouseEvent& event); | 265 virtual void OnMouseMoved(const views::MouseEvent& event); |
| 266 virtual void OnMouseExited(const views::MouseEvent& event); | 266 virtual void OnMouseExited(const views::MouseEvent& event); |
| 267 virtual bool OnMousePressed(const views::MouseEvent& event) = 0; | 267 virtual bool OnMousePressed(const views::MouseEvent& event) = 0; |
| 268 | 268 |
| 269 // InfoBubbleDelegate | 269 // InfoBubbleDelegate |
| 270 void InfoBubbleClosing(InfoBubble* info_bubble, bool closed_by_escape); | 270 void InfoBubbleClosing(InfoBubble* info_bubble, bool closed_by_escape); |
| 271 bool CloseOnEscape() { return true; } | 271 bool CloseOnEscape() { return true; } |
| 272 | 272 |
| 273 virtual void ShowInfoBubble() = 0; | 273 virtual void ShowInfoBubble() = 0; |
| 274 | 274 |
| 275 protected: | 275 protected: |
| 276 void ShowInfoBubbleImpl(const std::wstring& text, SkColor text_color); | 276 void ShowInfoBubbleImpl(const std::wstring& text, SkColor text_color); |
| 277 | 277 |
| 278 private: | 278 private: |
| 279 friend class ShowInfoBubbleTask; | 279 friend class ShowInfoBubbleTask; |
| 280 | 280 |
| 281 // The currently shown info bubble if any. | 281 // The currently shown info bubble if any. |
| 282 InfoBubble* info_bubble_; | 282 InfoBubble* info_bubble_; |
| 283 | 283 |
| 284 // A task used to display the info bubble when the mouse hovers on the | 284 // A task used to display the info bubble when the mouse hovers on the |
| 285 // image. | 285 // image. |
| 286 ShowInfoBubbleTask* show_info_bubble_task_; | 286 ShowInfoBubbleTask* show_info_bubble_task_; |
| 287 | 287 |
| 288 // A positioner used to give the info bubble the correct target bounds. The |
| 289 // caller maintains ownership of this and must ensure it's kept alive. |
| 290 const BubblePositioner* bubble_positioner_; |
| 291 |
| 288 DISALLOW_COPY_AND_ASSIGN(LocationBarImageView); | 292 DISALLOW_COPY_AND_ASSIGN(LocationBarImageView); |
| 289 }; | 293 }; |
| 290 | 294 |
| 291 // SecurityImageView is used to display the lock or warning icon when the | 295 // SecurityImageView is used to display the lock or warning icon when the |
| 292 // current URL's scheme is https. | 296 // current URL's scheme is https. |
| 293 // | 297 // |
| 294 // If a message has been set with SetInfoBubbleText, it displays an info | 298 // If a message has been set with SetInfoBubbleText, it displays an info |
| 295 // bubble when the mouse hovers on the image. | 299 // bubble when the mouse hovers on the image. |
| 296 class SecurityImageView : public LocationBarImageView { | 300 class SecurityImageView : public LocationBarImageView { |
| 297 public: | 301 public: |
| 298 enum Image { | 302 enum Image { |
| 299 LOCK = 0, | 303 LOCK = 0, |
| 300 WARNING | 304 WARNING |
| 301 }; | 305 }; |
| 302 | 306 |
| 303 SecurityImageView(Profile* profile, ToolbarModel* model_); | 307 SecurityImageView(Profile* profile, |
| 308 ToolbarModel* model_, |
| 309 const BubblePositioner* bubble_positioner); |
| 304 virtual ~SecurityImageView(); | 310 virtual ~SecurityImageView(); |
| 305 | 311 |
| 306 // Sets the image that should be displayed. | 312 // Sets the image that should be displayed. |
| 307 void SetImageShown(Image image); | 313 void SetImageShown(Image image); |
| 308 | 314 |
| 309 // Overridden from view for the mouse hovering. | 315 // Overridden from view for the mouse hovering. |
| 310 virtual bool OnMousePressed(const views::MouseEvent& event); | 316 virtual bool OnMousePressed(const views::MouseEvent& event); |
| 311 | 317 |
| 312 void set_profile(Profile* profile) { profile_ = profile; } | 318 void set_profile(Profile* profile) { profile_ = profile; } |
| 313 | 319 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 334 DISALLOW_COPY_AND_ASSIGN(SecurityImageView); | 340 DISALLOW_COPY_AND_ASSIGN(SecurityImageView); |
| 335 }; | 341 }; |
| 336 | 342 |
| 337 // PageActionImageView is used to display the icon for a given PageAction | 343 // PageActionImageView is used to display the icon for a given PageAction |
| 338 // and notify the extension when the icon is clicked. | 344 // and notify the extension when the icon is clicked. |
| 339 class PageActionImageView : public LocationBarImageView, | 345 class PageActionImageView : public LocationBarImageView, |
| 340 public ImageLoadingTracker::Observer { | 346 public ImageLoadingTracker::Observer { |
| 341 public: | 347 public: |
| 342 PageActionImageView(LocationBarView* owner, | 348 PageActionImageView(LocationBarView* owner, |
| 343 Profile* profile, | 349 Profile* profile, |
| 344 const PageAction* page_action); | 350 const PageAction* page_action, |
| 351 const BubblePositioner* bubble_positioner); |
| 345 virtual ~PageActionImageView(); | 352 virtual ~PageActionImageView(); |
| 346 | 353 |
| 347 // Overridden from view for the mouse hovering. | 354 // Overridden from view for the mouse hovering. |
| 348 virtual bool OnMousePressed(const views::MouseEvent& event); | 355 virtual bool OnMousePressed(const views::MouseEvent& event); |
| 349 | 356 |
| 350 // Overridden from LocationBarImageView. | 357 // Overridden from LocationBarImageView. |
| 351 virtual void ShowInfoBubble(); | 358 virtual void ShowInfoBubble(); |
| 352 | 359 |
| 353 // Overridden from ImageLoadingTracker. | 360 // Overridden from ImageLoadingTracker. |
| 354 virtual void OnImageLoaded(SkBitmap* image, size_t index); | 361 virtual void OnImageLoaded(SkBitmap* image, size_t index); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 // The positioner that places the omnibox and info bubbles. | 528 // The positioner that places the omnibox and info bubbles. |
| 522 const BubblePositioner* bubble_positioner_; | 529 const BubblePositioner* bubble_positioner_; |
| 523 | 530 |
| 524 // Storage of string needed for accessibility. | 531 // Storage of string needed for accessibility. |
| 525 std::wstring accessible_name_; | 532 std::wstring accessible_name_; |
| 526 | 533 |
| 527 DISALLOW_COPY_AND_ASSIGN(LocationBarView); | 534 DISALLOW_COPY_AND_ASSIGN(LocationBarView); |
| 528 }; | 535 }; |
| 529 | 536 |
| 530 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ | 537 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ |
| OLD | NEW |