OLD | NEW |
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 CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ |
6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/process/kill.h" | 13 #include "base/process/kill.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "base/supports_user_data.h" | 15 #include "base/supports_user_data.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
17 #include "content/public/browser/navigation_controller.h" | 17 #include "content/public/browser/navigation_controller.h" |
18 #include "content/public/browser/page_navigator.h" | 18 #include "content/public/browser/page_navigator.h" |
19 #include "content/public/browser/save_page_type.h" | 19 #include "content/public/browser/save_page_type.h" |
20 #include "content/public/browser/web_ui.h" | 20 #include "content/public/browser/web_ui.h" |
| 21 #include "content/public/common/page_zoom.h" |
21 #include "content/public/common/stop_find_action.h" | 22 #include "content/public/common/stop_find_action.h" |
22 #include "ipc/ipc_sender.h" | 23 #include "ipc/ipc_sender.h" |
23 #include "third_party/skia/include/core/SkColor.h" | 24 #include "third_party/skia/include/core/SkColor.h" |
24 #include "ui/base/window_open_disposition.h" | 25 #include "ui/base/window_open_disposition.h" |
25 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
26 #include "ui/gfx/size.h" | 27 #include "ui/gfx/size.h" |
27 | 28 |
28 #if defined(OS_ANDROID) | 29 #if defined(OS_ANDROID) |
29 #include "base/android/scoped_java_ref.h" | 30 #include "base/android/scoped_java_ref.h" |
30 #endif | 31 #endif |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 // bombing), see DownloadRequestLimiter for details. | 418 // bombing), see DownloadRequestLimiter for details. |
418 virtual void UserGestureDone() = 0; | 419 virtual void UserGestureDone() = 0; |
419 | 420 |
420 // Indicates if this tab was explicitly closed by the user (control-w, close | 421 // Indicates if this tab was explicitly closed by the user (control-w, close |
421 // tab menu item...). This is false for actions that indirectly close the tab, | 422 // tab menu item...). This is false for actions that indirectly close the tab, |
422 // such as closing the window. The setter is maintained by TabStripModel, and | 423 // such as closing the window. The setter is maintained by TabStripModel, and |
423 // the getter only useful from within TAB_CLOSED notification | 424 // the getter only useful from within TAB_CLOSED notification |
424 virtual void SetClosedByUserGesture(bool value) = 0; | 425 virtual void SetClosedByUserGesture(bool value) = 0; |
425 virtual bool GetClosedByUserGesture() const = 0; | 426 virtual bool GetClosedByUserGesture() const = 0; |
426 | 427 |
| 428 // Gets the zoom mode for this WebContents, which determines the behavior of |
| 429 // zoom changes. |
| 430 virtual ZoomMode GetZoomMode() const = 0; |
| 431 |
427 // Gets the zoom level for this tab. | 432 // Gets the zoom level for this tab. |
428 virtual double GetZoomLevel() const = 0; | 433 virtual double GetZoomLevel() const = 0; |
429 | 434 |
430 // Gets the zoom percent for this tab. | 435 // Gets the zoom percent for this tab. |
431 virtual int GetZoomPercent(bool* enable_increment, | 436 virtual int GetZoomPercent(bool* enable_increment, |
432 bool* enable_decrement) const = 0; | 437 bool* enable_decrement) const = 0; |
433 | 438 |
434 // Opens view-source tab for this contents. | 439 // Opens view-source tab for this contents. |
435 virtual void ViewSource() = 0; | 440 virtual void ViewSource() = 0; |
436 | 441 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 bool is_favicon, | 492 bool is_favicon, |
488 uint32_t max_bitmap_size, | 493 uint32_t max_bitmap_size, |
489 const ImageDownloadCallback& callback) = 0; | 494 const ImageDownloadCallback& callback) = 0; |
490 | 495 |
491 // Returns true if the WebContents is responsible for displaying a subframe | 496 // Returns true if the WebContents is responsible for displaying a subframe |
492 // in a different process from its parent page. | 497 // in a different process from its parent page. |
493 // TODO: this doesn't really belong here. With site isolation, this should be | 498 // TODO: this doesn't really belong here. With site isolation, this should be |
494 // removed since we can then embed iframes in different processes. | 499 // removed since we can then embed iframes in different processes. |
495 virtual bool IsSubframe() const = 0; | 500 virtual bool IsSubframe() const = 0; |
496 | 501 |
| 502 // Sets the flag indicating whether zooming will have default behavior. |
| 503 virtual void SetZoomMode(ZoomMode mode) = 0; |
| 504 |
497 // Sets the zoom level for the current page and all BrowserPluginGuests | 505 // Sets the zoom level for the current page and all BrowserPluginGuests |
498 // within the page. | 506 // within the page. |
499 virtual void SetZoomLevel(double level) = 0; | 507 virtual void SetZoomLevel(double level) = 0; |
500 | 508 |
| 509 // Optionally provide a callback function to be called after the zoom change |
| 510 // has completed. |
| 511 virtual void SetZoomLevel(double level, |
| 512 const base::Callback<void(void)>& callback) = 0; |
| 513 |
501 // Finds text on a page. | 514 // Finds text on a page. |
502 virtual void Find(int request_id, | 515 virtual void Find(int request_id, |
503 const base::string16& search_text, | 516 const base::string16& search_text, |
504 const blink::WebFindOptions& options) = 0; | 517 const blink::WebFindOptions& options) = 0; |
505 | 518 |
506 // Notifies the renderer that the user has closed the FindInPage window | 519 // Notifies the renderer that the user has closed the FindInPage window |
507 // (and what action to take regarding the selection). | 520 // (and what action to take regarding the selection). |
508 virtual void StopFinding(StopFindAction action) = 0; | 521 virtual void StopFinding(StopFindAction action) = 0; |
509 | 522 |
510 #if defined(OS_ANDROID) | 523 #if defined(OS_ANDROID) |
511 CONTENT_EXPORT static WebContents* FromJavaWebContents( | 524 CONTENT_EXPORT static WebContents* FromJavaWebContents( |
512 jobject jweb_contents_android); | 525 jobject jweb_contents_android); |
513 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() = 0; | 526 virtual base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() = 0; |
514 #endif // OS_ANDROID | 527 #endif // OS_ANDROID |
515 | 528 |
516 private: | 529 private: |
517 // This interface should only be implemented inside content. | 530 // This interface should only be implemented inside content. |
518 friend class WebContentsImpl; | 531 friend class WebContentsImpl; |
519 WebContents() {} | 532 WebContents() {} |
520 }; | 533 }; |
521 | 534 |
522 } // namespace content | 535 } // namespace content |
523 | 536 |
524 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ | 537 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ |
OLD | NEW |