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

Side by Side Diff: chrome/browser/ui/panels/panel.h

Issue 11886029: Use ImageLoader instead of ImageLoadingTracker (Part 9) (Closed) Base URL: https://git.chromium.org/chromium/src.git@Issue_163929
Patch Set: Created 7 years, 11 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
OLDNEW
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 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_H_ 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_H_ 6 #define CHROME_BROWSER_UI_PANELS_PANEL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
12 #include "base/string16.h" 13 #include "base/string16.h"
13 #include "chrome/browser/command_updater.h" 14 #include "chrome/browser/command_updater.h"
14 #include "chrome/browser/command_updater_delegate.h" 15 #include "chrome/browser/command_updater_delegate.h"
15 #include "chrome/browser/extensions/image_loading_tracker.h"
16 #include "chrome/browser/sessions/session_id.h" 16 #include "chrome/browser/sessions/session_id.h"
17 #include "chrome/browser/ui/base_window.h" 17 #include "chrome/browser/ui/base_window.h"
18 #include "chrome/browser/ui/panels/panel_constants.h" 18 #include "chrome/browser/ui/panels/panel_constants.h"
19 #include "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 20 #include "content/public/browser/notification_registrar.h"
21 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
22 #include "ui/gfx/rect.h" 22 #include "ui/gfx/rect.h"
23 23
24 class GURL; 24 class GURL;
25 class NativePanel; 25 class NativePanel;
(...skipping 16 matching lines...) Expand all
42 // This class gets the first crack at all the BaseWindow calls for Panels and 42 // This class gets the first crack at all the BaseWindow calls for Panels and
43 // does one or more of the following: 43 // does one or more of the following:
44 // - Do nothing. The function is not relevant to Panels. 44 // - Do nothing. The function is not relevant to Panels.
45 // - Do Panel specific platform independent processing and then invoke the 45 // - Do Panel specific platform independent processing and then invoke the
46 // function on the platform specific member. For example, restrict panel 46 // function on the platform specific member. For example, restrict panel
47 // size to certain limits. 47 // size to certain limits.
48 // - Invoke an appropriate PanelManager function to do stuff that might affect 48 // - Invoke an appropriate PanelManager function to do stuff that might affect
49 // other Panels. For example deleting a panel would rearrange other panels. 49 // other Panels. For example deleting a panel would rearrange other panels.
50 class Panel : public BaseWindow, 50 class Panel : public BaseWindow,
51 public CommandUpdaterDelegate, 51 public CommandUpdaterDelegate,
52 public content::NotificationObserver, 52 public content::NotificationObserver {
53 public ImageLoadingTracker::Observer {
54 public: 53 public:
55 enum ExpansionState { 54 enum ExpansionState {
56 // The panel is fully expanded with both title-bar and the client-area. 55 // The panel is fully expanded with both title-bar and the client-area.
57 EXPANDED, 56 EXPANDED,
58 // The panel is shown with the title-bar only. 57 // The panel is shown with the title-bar only.
59 TITLE_ONLY, 58 TITLE_ONLY,
60 // The panel is shown with 3-pixel line. 59 // The panel is shown with 3-pixel line.
61 MINIMIZED 60 MINIMIZED
62 }; 61 };
63 62
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 friend class PanelManager; 306 friend class PanelManager;
308 friend class PanelBrowserTest; 307 friend class PanelBrowserTest;
309 308
310 enum MaxSizePolicy { 309 enum MaxSizePolicy {
311 // Default maximum size is proportional to the work area. 310 // Default maximum size is proportional to the work area.
312 DEFAULT_MAX_SIZE, 311 DEFAULT_MAX_SIZE,
313 // Custom maximum size is used when the panel is resized by the user. 312 // Custom maximum size is used when the panel is resized by the user.
314 CUSTOM_MAX_SIZE 313 CUSTOM_MAX_SIZE
315 }; 314 };
316 315
317 // ImageLoadingTracker::Observer implementation. 316 void OnImageLoaded(const gfx::Image& image);
318 virtual void OnImageLoaded(const gfx::Image& image,
319 const std::string& extension_id,
320 int index) OVERRIDE;
321 317
322 // Initialize state for all supported commands. 318 // Initialize state for all supported commands.
323 void InitCommandState(); 319 void InitCommandState();
324 320
325 // Configures the renderer for auto resize (if auto resize is enabled). 321 // Configures the renderer for auto resize (if auto resize is enabled).
326 void ConfigureAutoResize(content::WebContents* web_contents); 322 void ConfigureAutoResize(content::WebContents* web_contents);
327 323
328 const extensions::Extension* GetExtension() const; 324 const extensions::Extension* GetExtension() const;
329 325
330 // Load the app's image, firing a load state change when loaded. 326 // Load the app's image, firing a load state change when loaded.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 ExpansionState expansion_state_; 373 ExpansionState expansion_state_;
378 374
379 // The CommandUpdater manages the window commands. 375 // The CommandUpdater manages the window commands.
380 CommandUpdater command_updater_; 376 CommandUpdater command_updater_;
381 377
382 content::NotificationRegistrar registrar_; 378 content::NotificationRegistrar registrar_;
383 const SessionID session_id_; 379 const SessionID session_id_;
384 scoped_ptr<extensions::WindowController> extension_window_controller_; 380 scoped_ptr<extensions::WindowController> extension_window_controller_;
385 scoped_ptr<PanelHost> panel_host_; 381 scoped_ptr<PanelHost> panel_host_;
386 382
387 // Used for loading app_icon_.
388 scoped_ptr<ImageLoadingTracker> app_icon_loader_;
389
390 // Icon showed in the task bar. 383 // Icon showed in the task bar.
391 gfx::Image app_icon_; 384 gfx::Image app_icon_;
392 385
386 base::WeakPtrFactory<Panel> weak_ptr_factory_;
387
393 DISALLOW_COPY_AND_ASSIGN(Panel); 388 DISALLOW_COPY_AND_ASSIGN(Panel);
394 }; 389 };
395 390
396 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ 391 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698