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

Unified Diff: chrome/browser/thumbnails/thumbnailing_context.h

Issue 11985003: Refactored-out the code of thumbnaling algorithm from thumbnail_tab_helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/thumbnails/thumbnailing_context.h
diff --git a/chrome/browser/thumbnails/thumbnailing_context.h b/chrome/browser/thumbnails/thumbnailing_context.h
new file mode 100644
index 0000000000000000000000000000000000000000..2410b03088c55a6bfa65b206a580b4a3517b7403
--- /dev/null
+++ b/chrome/browser/thumbnails/thumbnailing_context.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_THUMBNAILS_THUMBNAILING_CONTEXT_H_
+#define CHROME_BROWSER_THUMBNAILS_THUMBNAILING_CONTEXT_H_
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "chrome/common/thumbnail_score.h"
+#include "content/public/browser/web_contents.h"
+
+namespace thumbnails {
+
+// The result of clipping. This can be used to determine if the
+// generated thumbnail is good or not.
+enum ClipResult {
+ // Clipping is not done yet.
+ kUnprocessed,
sky 2013/01/17 20:18:36 chrome style is enums should be CAPS_CASE.
motek. 2013/01/18 18:38:41 Done.
+ // The source image is smaller.
+ kSourceIsSmaller,
+ // Wider than tall by twice or more, clip horizontally.
+ kTooWiderThanTall,
+ // Wider than tall, clip horizontally.
+ kWiderThanTall,
+ // Taller than wide, clip vertically.
+ kTallerThanWide,
+ // The source and destination aspect ratios are identical.
+ kNotClipped,
+};
+
+// Holds the information needed for processing a thumbnail.
+struct ThumbnailingContext : base::RefCountedThreadSafe<ThumbnailingContext> {
sky 2013/01/17 20:18:36 Why does this need to be RefCountedThreadSafe? If
motek. 2013/01/18 18:38:41 Right. I copied it from elsewhere, without thinkin
+ ThumbnailingContext(content::WebContents* web_contents,
+ bool load_interrupted);
+
+ content::BrowserContext* browser_context;
+ GURL url;
+ ClipResult clip_result;
+ ThumbnailScore score;
+
+ private:
+ ~ThumbnailingContext();
+ friend class base::RefCountedThreadSafe<ThumbnailingContext>;
+};
+
+}
+
+#endif // CHROME_BROWSER_THUMBNAILS_THUMBNAILING_CONTEXT_H_

Powered by Google App Engine
This is Rietveld 408576698