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

Side by Side Diff: chrome/browser/automation/automation_provider_observers.h

Issue 8294030: Fix snapshotting on linux by creating a separate automation path for (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_
6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 #include <map> 10 #include <map>
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 const NotificationDetails& details); 1329 const NotificationDetails& details);
1330 1330
1331 private: 1331 private:
1332 NotificationRegistrar registrar_; 1332 NotificationRegistrar registrar_;
1333 base::WeakPtr<AutomationProvider> automation_; 1333 base::WeakPtr<AutomationProvider> automation_;
1334 scoped_ptr<IPC::Message> reply_message_; 1334 scoped_ptr<IPC::Message> reply_message_;
1335 1335
1336 DISALLOW_COPY_AND_ASSIGN(SavePackageNotificationObserver); 1336 DISALLOW_COPY_AND_ASSIGN(SavePackageNotificationObserver);
1337 }; 1337 };
1338 1338
1339 // This class manages taking a snapshot of a page. This requires waiting on 1339 // This class manages taking a snapshot of a page.
1340 // asynchronous callbacks and notifications. 1340 class PageSnapshotTaker : public TabEventObserver, public NotificationObserver {
1341 class PageSnapshotTaker : public DomOperationObserver {
1342 public: 1341 public:
1343 PageSnapshotTaker(AutomationProvider* automation, 1342 PageSnapshotTaker(AutomationProvider* automation,
1344 IPC::Message* reply_message, 1343 IPC::Message* reply_message,
1345 RenderViewHost* render_view, 1344 TabContentsWrapper* tab_contents,
1346 const FilePath& path); 1345 const FilePath& path);
1347 virtual ~PageSnapshotTaker(); 1346 virtual ~PageSnapshotTaker();
1348 1347
1349 // Start the process of taking a snapshot of the entire page. 1348 // Start the process of taking a snapshot of the entire page.
1350 void Start(); 1349 void Start();
1351 1350
1352 private: 1351 private:
1353 // Overriden from DomOperationObserver. 1352 // TabEventObserver overrides.
1354 virtual void OnDomOperationCompleted(const std::string& json) OVERRIDE; 1353 virtual void OnSnapshotEntirePageACK(
1355 virtual void OnModalDialogShown() OVERRIDE; 1354 bool success,
1356 1355 const std::vector<unsigned char>& png_data,
1357 // Called by the ThumbnailGenerator when the requested snapshot has been 1356 const std::string& error_msg) OVERRIDE;
1358 // generated. 1357 // NotificationObserver overrides.
1359 void OnSnapshotTaken(const SkBitmap& bitmap); 1358 virtual void Observe(int type,
1360 1359 const NotificationSource& source,
1361 // Helper method to send arbitrary javascript to the renderer for evaluation. 1360 const NotificationDetails& details);
1362 void ExecuteScript(const std::wstring& javascript);
1363 1361
1364 // Helper method to send a response back to the client. Deletes this. 1362 // Helper method to send a response back to the client. Deletes this.
1365 void SendMessage(bool success, const std::string& error_msg); 1363 void SendMessage(bool success, const std::string& error_msg);
1366 1364
1367 base::WeakPtr<AutomationProvider> automation_; 1365 base::WeakPtr<AutomationProvider> automation_;
1368 scoped_ptr<IPC::Message> reply_message_; 1366 scoped_ptr<IPC::Message> reply_message_;
1369 RenderViewHost* render_view_; 1367 TabContentsWrapper* tab_contents_;
1370 FilePath image_path_; 1368 FilePath image_path_;
1371 bool received_width_; 1369 NotificationRegistrar registrar_;
1372 gfx::Size entire_page_size_;
1373 1370
1374 DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker); 1371 DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker);
1375 }; 1372 };
1376 1373
1377 class NTPInfoObserver : public NotificationObserver { 1374 class NTPInfoObserver : public NotificationObserver {
1378 public: 1375 public:
1379 NTPInfoObserver(AutomationProvider* automation, 1376 NTPInfoObserver(AutomationProvider* automation,
1380 IPC::Message* reply_message, 1377 IPC::Message* reply_message,
1381 CancelableRequestConsumer* consumer); 1378 CancelableRequestConsumer* consumer);
1382 virtual ~NTPInfoObserver(); 1379 virtual ~NTPInfoObserver();
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 private: 1771 private:
1775 NotificationRegistrar registrar_; 1772 NotificationRegistrar registrar_;
1776 base::WeakPtr<AutomationProvider> automation_; 1773 base::WeakPtr<AutomationProvider> automation_;
1777 scoped_ptr<IPC::Message> reply_message_; 1774 scoped_ptr<IPC::Message> reply_message_;
1778 int new_window_id_; 1775 int new_window_id_;
1779 1776
1780 DISALLOW_COPY_AND_ASSIGN(BrowserOpenedWithNewProfileNotificationObserver); 1777 DISALLOW_COPY_AND_ASSIGN(BrowserOpenedWithNewProfileNotificationObserver);
1781 }; 1778 };
1782 1779
1783 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ 1780 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698