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

Side by Side Diff: chrome/browser/views/location_bar_view.h

Issue 425018: Merge 32277 - Fix a crash when activating a select element inside a page... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/249/src/
Patch Set: Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/browser_bubble.h ('k') | chrome/browser/views/location_bar_view.cc » ('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) 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 <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
11 11
12 #include "app/gfx/font.h" 12 #include "app/gfx/font.h"
13 #include "base/gfx/rect.h" 13 #include "base/gfx/rect.h"
14 #include "base/task.h"
14 #include "chrome/browser/autocomplete/autocomplete_edit.h" 15 #include "chrome/browser/autocomplete/autocomplete_edit.h"
15 #include "chrome/browser/extensions/image_loading_tracker.h" 16 #include "chrome/browser/extensions/image_loading_tracker.h"
16 #include "chrome/browser/location_bar.h" 17 #include "chrome/browser/location_bar.h"
17 #include "chrome/browser/tab_contents/tab_contents.h" 18 #include "chrome/browser/tab_contents/tab_contents.h"
18 #include "chrome/browser/toolbar_model.h" 19 #include "chrome/browser/toolbar_model.h"
20 #include "chrome/browser/views/browser_bubble.h"
19 #include "chrome/browser/views/info_bubble.h" 21 #include "chrome/browser/views/info_bubble.h"
20 #include "views/controls/image_view.h" 22 #include "views/controls/image_view.h"
21 #include "views/controls/label.h" 23 #include "views/controls/label.h"
22 #include "views/controls/native/native_view_host.h" 24 #include "views/controls/native/native_view_host.h"
23 #include "views/painter.h" 25 #include "views/painter.h"
24 26
25 #if defined(OS_WIN) 27 #if defined(OS_WIN)
26 #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h" 28 #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h"
27 #else 29 #else
28 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" 30 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
29 #endif 31 #endif
30 32
31 class BubblePositioner; 33 class BubblePositioner;
32 class CommandUpdater; 34 class CommandUpdater;
33 class ExtensionAction; 35 class ExtensionAction;
36 class ExtensionPopup;
34 class GURL; 37 class GURL;
35 class Profile; 38 class Profile;
36 39
37 ///////////////////////////////////////////////////////////////////////////// 40 /////////////////////////////////////////////////////////////////////////////
38 // 41 //
39 // LocationBarView class 42 // LocationBarView class
40 // 43 //
41 // The LocationBarView class is a View subclass that paints the background 44 // The LocationBarView class is a View subclass that paints the background
42 // of the URL bar strip and contains its content. 45 // of the URL bar strip and contains its content.
43 // 46 //
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 Profile* profile_; 355 Profile* profile_;
353 356
354 ToolbarModel* model_; 357 ToolbarModel* model_;
355 358
356 DISALLOW_COPY_AND_ASSIGN(SecurityImageView); 359 DISALLOW_COPY_AND_ASSIGN(SecurityImageView);
357 }; 360 };
358 361
359 // PageActionImageView is used to display the icon for a given PageAction 362 // PageActionImageView is used to display the icon for a given PageAction
360 // and notify the extension when the icon is clicked. 363 // and notify the extension when the icon is clicked.
361 class PageActionImageView : public LocationBarImageView, 364 class PageActionImageView : public LocationBarImageView,
362 public ImageLoadingTracker::Observer { 365 public ImageLoadingTracker::Observer,
366 public BrowserBubble::Delegate {
363 public: 367 public:
364 PageActionImageView(LocationBarView* owner, 368 PageActionImageView(LocationBarView* owner,
365 Profile* profile, 369 Profile* profile,
366 ExtensionAction* page_action, 370 ExtensionAction* page_action,
367 const BubblePositioner* bubble_positioner); 371 const BubblePositioner* bubble_positioner);
368 virtual ~PageActionImageView(); 372 virtual ~PageActionImageView();
369 373
370 ExtensionAction* page_action() { return page_action_; } 374 ExtensionAction* page_action() { return page_action_; }
371 375
372 int current_tab_id() { return current_tab_id_; } 376 int current_tab_id() { return current_tab_id_; }
373 377
374 void set_preview_enabled(bool preview_enabled) { 378 void set_preview_enabled(bool preview_enabled) {
375 preview_enabled_ = preview_enabled; 379 preview_enabled_ = preview_enabled;
376 } 380 }
377 381
378 // Overridden from view. 382 // Overridden from view.
379 virtual void OnMouseMoved(const views::MouseEvent& event); 383 virtual void OnMouseMoved(const views::MouseEvent& event);
380 virtual bool OnMousePressed(const views::MouseEvent& event); 384 virtual bool OnMousePressed(const views::MouseEvent& event);
381 385
382 // Overridden from LocationBarImageView. 386 // Overridden from LocationBarImageView.
383 virtual void ShowInfoBubble(); 387 virtual void ShowInfoBubble();
384 388
385 // Overridden from ImageLoadingTracker. 389 // Overridden from ImageLoadingTracker.
386 virtual void OnImageLoaded(SkBitmap* image, size_t index); 390 virtual void OnImageLoaded(SkBitmap* image, size_t index);
387 391
392 // Overridden from BrowserBubble::Delegate
393 virtual void BubbleBrowserWindowClosing(BrowserBubble* bubble);
394 virtual void BubbleLostFocus(BrowserBubble* bubble);
395
388 // Called to notify the PageAction that it should determine whether to be 396 // Called to notify the PageAction that it should determine whether to be
389 // visible or hidden. |contents| is the TabContents that is active, |url| 397 // visible or hidden. |contents| is the TabContents that is active, |url|
390 // is the current page URL. 398 // is the current page URL.
391 void UpdateVisibility(TabContents* contents, const GURL& url); 399 void UpdateVisibility(TabContents* contents, const GURL& url);
392 400
393 // Either notify listners or show a popup depending on the page action. 401 // Either notify listners or show a popup depending on the page action.
394 void ExecuteAction(int button); 402 void ExecuteAction(int button);
395 403
396 private: 404 private:
405 // Hides the active popup, if there is one.
406 void HidePopup();
407
397 // The location bar view that owns us. 408 // The location bar view that owns us.
398 LocationBarView* owner_; 409 LocationBarView* owner_;
399 410
400 // The current profile (not owned by us). 411 // The current profile (not owned by us).
401 Profile* profile_; 412 Profile* profile_;
402 413
403 // The PageAction that this view represents. The PageAction is not owned by 414 // The PageAction that this view represents. The PageAction is not owned by
404 // us, it resides in the extension of this particular profile. 415 // us, it resides in the extension of this particular profile.
405 ExtensionAction* page_action_; 416 ExtensionAction* page_action_;
406 417
(...skipping 11 matching lines...) Expand all
418 // The URL we are currently showing the icon for. 429 // The URL we are currently showing the icon for.
419 GURL current_url_; 430 GURL current_url_;
420 431
421 // The string to show for a tooltip; 432 // The string to show for a tooltip;
422 std::string tooltip_; 433 std::string tooltip_;
423 434
424 // This is used for post-install visual feedback. The page_action icon 435 // This is used for post-install visual feedback. The page_action icon
425 // is briefly shown even if it hasn't been enabled by it's extension. 436 // is briefly shown even if it hasn't been enabled by it's extension.
426 bool preview_enabled_; 437 bool preview_enabled_;
427 438
439 // The current popup and the button it came from. NULL if no popup.
440 ExtensionPopup* popup_;
441
442 ScopedRunnableMethodFactory<PageActionImageView> method_factory_;
443
428 DISALLOW_COPY_AND_ASSIGN(PageActionImageView); 444 DISALLOW_COPY_AND_ASSIGN(PageActionImageView);
429 }; 445 };
430 friend class PageActionImageView; 446 friend class PageActionImageView;
431 447
432 class PageActionWithBadgeView; 448 class PageActionWithBadgeView;
433 friend class PageActionWithBadgeView; 449 friend class PageActionWithBadgeView;
434 // Both Layout and OnChanged call into this. This updates the contents 450 // Both Layout and OnChanged call into this. This updates the contents
435 // of the 3 views: selected_keyword, keyword_hint and type_search_view. If 451 // of the 3 views: selected_keyword, keyword_hint and type_search_view. If
436 // force_layout is true, or one of these views has changed in such a way as 452 // force_layout is true, or one of these views has changed in such a way as
437 // to necessitate a layout, layout occurs as well. 453 // to necessitate a layout, layout occurs as well.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 // The positioner that places the omnibox and info bubbles. 580 // The positioner that places the omnibox and info bubbles.
565 const BubblePositioner* bubble_positioner_; 581 const BubblePositioner* bubble_positioner_;
566 582
567 // Storage of string needed for accessibility. 583 // Storage of string needed for accessibility.
568 std::wstring accessible_name_; 584 std::wstring accessible_name_;
569 585
570 DISALLOW_COPY_AND_ASSIGN(LocationBarView); 586 DISALLOW_COPY_AND_ASSIGN(LocationBarView);
571 }; 587 };
572 588
573 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ 589 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/views/browser_bubble.h ('k') | chrome/browser/views/location_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698