| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 // Implementation of BlockedPopupContainer and its corresponding View | 5 // Implementation of BlockedPopupContainer and its corresponding View |
| 6 // class. The BlockedPopupContainer is the sort of Model class which owns the | 6 // class. The BlockedPopupContainer is the sort of Model class which owns the |
| 7 // blocked popups' TabContents (but like most Chromium interface code, it there | 7 // blocked popups' TabContents (but like most Chromium interface code, it there |
| 8 // isn't a strict Model/View separation), and BlockedPopupContainerView | 8 // isn't a strict Model/View separation), and BlockedPopupContainerView |
| 9 // presents the user interface controls, creates and manages the popup menu. | 9 // presents the user interface controls, creates and manages the popup menu. |
| 10 | 10 |
| 11 #include "chrome/browser/views/blocked_popup_container.h" | 11 #include "chrome/browser/views/blocked_popup_container.h" |
| 12 | 12 |
| 13 #include <math.h> | 13 #include <math.h> |
| 14 | 14 |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 16 #include "chrome/browser/profile.h" | 17 #include "chrome/browser/profile.h" |
| 17 #include "chrome/browser/tab_contents/tab_contents.h" | 18 #include "chrome/browser/tab_contents/tab_contents.h" |
| 18 #include "chrome/common/gfx/chrome_canvas.h" | 19 #include "chrome/common/gfx/chrome_canvas.h" |
| 19 #include "chrome/common/gfx/path.h" | 20 #include "chrome/common/gfx/path.h" |
| 20 #include "chrome/common/l10n_util.h" | 21 #include "chrome/common/l10n_util.h" |
| 21 #include "chrome/common/notification_service.h" | 22 #include "chrome/common/notification_service.h" |
| 22 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 23 #include "chrome/common/resource_bundle.h" | 24 #include "chrome/common/resource_bundle.h" |
| 24 #include "chrome/views/background.h" | 25 #include "chrome/views/background.h" |
| 25 #include "chrome/views/controls/button/image_button.h" | 26 #include "chrome/views/controls/button/image_button.h" |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 387 |
| 387 bool BlockedPopupContainer::IsPopup(TabContents* source) { | 388 bool BlockedPopupContainer::IsPopup(TabContents* source) { |
| 388 return true; | 389 return true; |
| 389 } | 390 } |
| 390 | 391 |
| 391 TabContents* BlockedPopupContainer::GetConstrainingContents( | 392 TabContents* BlockedPopupContainer::GetConstrainingContents( |
| 392 TabContents* source) { | 393 TabContents* source) { |
| 393 return owner_; | 394 return owner_; |
| 394 } | 395 } |
| 395 | 396 |
| 397 ExtensionFunctionDispatcher* BlockedPopupContainer:: |
| 398 CreateExtensionFunctionDispatcher(RenderViewHost* render_view_host, |
| 399 const std::string& extension_id) { |
| 400 return new ExtensionFunctionDispatcher(render_view_host, NULL, extension_id); |
| 401 } |
| 402 |
| 396 // Overridden from Animation: | 403 // Overridden from Animation: |
| 397 void BlockedPopupContainer::AnimateToState(double state) { | 404 void BlockedPopupContainer::AnimateToState(double state) { |
| 398 if (in_show_animation_) | 405 if (in_show_animation_) |
| 399 visibility_percentage_ = state; | 406 visibility_percentage_ = state; |
| 400 else | 407 else |
| 401 visibility_percentage_ = 1 - state; | 408 visibility_percentage_ = 1 - state; |
| 402 | 409 |
| 403 SetPosition(); | 410 SetPosition(); |
| 404 } | 411 } |
| 405 | 412 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 483 |
| 477 void BlockedPopupContainer::CloseEachTabContents() { | 484 void BlockedPopupContainer::CloseEachTabContents() { |
| 478 while (!blocked_popups_.empty()) { | 485 while (!blocked_popups_.empty()) { |
| 479 blocked_popups_.back().first->set_delegate(NULL); | 486 blocked_popups_.back().first->set_delegate(NULL); |
| 480 delete blocked_popups_.back().first; | 487 delete blocked_popups_.back().first; |
| 481 blocked_popups_.pop_back(); | 488 blocked_popups_.pop_back(); |
| 482 } | 489 } |
| 483 | 490 |
| 484 blocked_popups_.clear(); | 491 blocked_popups_.clear(); |
| 485 } | 492 } |
| OLD | NEW |