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

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

Issue 195050: Linux: implement Page Actions support. (Closed)
Patch Set: comment clarification Created 11 years, 3 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 | « chrome/browser/image_loading_tracker.cc ('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 <vector> 9 #include <vector>
10 10
11 #include "app/gfx/font.h" 11 #include "app/gfx/font.h"
12 #include "base/gfx/rect.h" 12 #include "base/gfx/rect.h"
13 #include "chrome/browser/autocomplete/autocomplete_edit.h" 13 #include "chrome/browser/autocomplete/autocomplete_edit.h"
14 #include "chrome/browser/image_loading_tracker.h"
14 #include "chrome/browser/location_bar.h" 15 #include "chrome/browser/location_bar.h"
15 #include "chrome/browser/tab_contents/tab_contents.h" 16 #include "chrome/browser/tab_contents/tab_contents.h"
16 #include "chrome/browser/toolbar_model.h" 17 #include "chrome/browser/toolbar_model.h"
17 #include "chrome/browser/views/info_bubble.h" 18 #include "chrome/browser/views/info_bubble.h"
18 #include "views/controls/image_view.h" 19 #include "views/controls/image_view.h"
19 #include "views/controls/label.h" 20 #include "views/controls/label.h"
20 #include "views/controls/native/native_view_host.h" 21 #include "views/controls/native/native_view_host.h"
21 #include "views/painter.h" 22 #include "views/painter.h"
22 23
23 #if defined(OS_WIN) 24 #if defined(OS_WIN)
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 327
327 Profile* profile_; 328 Profile* profile_;
328 329
329 ToolbarModel* model_; 330 ToolbarModel* model_;
330 331
331 DISALLOW_COPY_AND_ASSIGN(SecurityImageView); 332 DISALLOW_COPY_AND_ASSIGN(SecurityImageView);
332 }; 333 };
333 334
334 // PageActionImageView is used to display the icon for a given PageAction 335 // PageActionImageView is used to display the icon for a given PageAction
335 // and notify the extension when the icon is clicked. 336 // and notify the extension when the icon is clicked.
336 class PageActionImageView : public LocationBarImageView { 337 class PageActionImageView : public LocationBarImageView,
338 public ImageLoadingTracker::Observer {
337 public: 339 public:
338 PageActionImageView( 340 PageActionImageView(
339 LocationBarView* owner, Profile* profile, 341 LocationBarView* owner, Profile* profile,
340 const PageAction* page_action); 342 const PageAction* page_action);
341 virtual ~PageActionImageView(); 343 virtual ~PageActionImageView();
342 344
343 // Overridden from view for the mouse hovering. 345 // Overridden from view for the mouse hovering.
344 virtual bool OnMousePressed(const views::MouseEvent& event); 346 virtual bool OnMousePressed(const views::MouseEvent& event);
345 347
346 // Overridden from LocationBarImageView. 348 // Overridden from LocationBarImageView.
347 virtual void ShowInfoBubble(); 349 virtual void ShowInfoBubble();
348 350
351 // Overridden from ImageLoadingTracker.
352 virtual void OnImageLoaded(SkBitmap* image, size_t index);
353
349 // Called to notify the PageAction that it should determine whether to be 354 // Called to notify the PageAction that it should determine whether to be
350 // visible or hidden. |contents| is the TabContents that is active, |url| 355 // visible or hidden. |contents| is the TabContents that is active, |url|
351 // is the current page URL. 356 // is the current page URL.
352 void UpdateVisibility(TabContents* contents, GURL url); 357 void UpdateVisibility(TabContents* contents, GURL url);
353 358
354 // A callback for when the image has loaded.
355 void OnImageLoaded(SkBitmap* image, size_t index);
356
357 private: 359 private:
358 // We load the images for the PageActions on the file thread. These tasks
359 // help with that.
360 class LoadImageTask;
361 class ImageLoadingTracker;
362
363 // The location bar view that owns us. 360 // The location bar view that owns us.
364 LocationBarView* owner_; 361 LocationBarView* owner_;
365 362
366 // The current profile (not owned by us). 363 // The current profile (not owned by us).
367 Profile* profile_; 364 Profile* profile_;
368 365
369 // The PageAction that this view represents. The PageAction is not owned by 366 // The PageAction that this view represents. The PageAction is not owned by
370 // us, it resides in the extension of this particular profile. 367 // us, it resides in the extension of this particular profile.
371 const PageAction* page_action_; 368 const PageAction* page_action_;
372 369
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 // made invisible. 421 // made invisible.
425 void LayoutView(bool leading, views::View* view, int available_width, 422 void LayoutView(bool leading, views::View* view, int available_width,
426 gfx::Rect* bounds); 423 gfx::Rect* bounds);
427 424
428 // Sets the security icon to display. Note that no repaint is done. 425 // Sets the security icon to display. Note that no repaint is done.
429 void SetSecurityIcon(ToolbarModel::Icon icon); 426 void SetSecurityIcon(ToolbarModel::Icon icon);
430 427
431 // Delete all page action views that we have created. 428 // Delete all page action views that we have created.
432 void DeletePageActionViews(); 429 void DeletePageActionViews();
433 430
434 // Retrieves a vector of all page actions, irrespective of which
435 // extension they belong to.
436 std::vector<PageAction*> GetPageActions();
437
438 // Update the views for the Page Actions, to reflect state changes for 431 // Update the views for the Page Actions, to reflect state changes for
439 // PageActions. 432 // PageActions.
440 void RefreshPageActionViews(); 433 void RefreshPageActionViews();
441 434
442 // Sets the text that should be displayed in the info label and its associated 435 // Sets the text that should be displayed in the info label and its associated
443 // tooltip text. Call with an empty string if the info label should be 436 // tooltip text. Call with an empty string if the info label should be
444 // hidden. 437 // hidden.
445 void SetInfoText(const std::wstring& text, 438 void SetInfoText(const std::wstring& text,
446 ToolbarModel::InfoTextType text_type, 439 ToolbarModel::InfoTextType text_type,
447 const std::wstring& tooltip_text); 440 const std::wstring& tooltip_text);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 // The positioner that places the autocomplete popup. 519 // The positioner that places the autocomplete popup.
527 AutocompletePopupPositioner* popup_positioner_; 520 AutocompletePopupPositioner* popup_positioner_;
528 521
529 // Storage of string needed for accessibility. 522 // Storage of string needed for accessibility.
530 std::wstring accessible_name_; 523 std::wstring accessible_name_;
531 524
532 DISALLOW_COPY_AND_ASSIGN(LocationBarView); 525 DISALLOW_COPY_AND_ASSIGN(LocationBarView);
533 }; 526 };
534 527
535 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_ 528 #endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/image_loading_tracker.cc ('k') | chrome/browser/views/location_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698