summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorgrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-31 09:37:51 +0000
committergrt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-31 09:37:51 +0000
commitbc39aa1459ca57fc5678e722aff4be30b31b0b39 (patch)
tree155cce41d94670e7e09c3e00206211009da66e31 /chrome_frame
parent69f08e311d4434b9e9bdadb2031f4107eee0cd90 (diff)
downloadchromium_src-bc39aa1459ca57fc5678e722aff4be30b31b0b39.zip
chromium_src-bc39aa1459ca57fc5678e722aff4be30b31b0b39.tar.gz
chromium_src-bc39aa1459ca57fc5678e722aff4be30b31b0b39.tar.bz2
Always show the Chrome Frame turndown prompt.
This change removes the dismiss button (reverting r213426 and r213521) as well as the reshow delta (effectively making the delta 0). BUG=none Review URL: https://codereview.chromium.org/52583002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232064 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/chrome_frame.gyp2
-rw-r--r--chrome_frame/resources/chrome_frame_resources.grd1
-rw-r--r--chrome_frame/turndown_prompt/reshow_state.cc39
-rw-r--r--chrome_frame/turndown_prompt/reshow_state.h26
-rw-r--r--chrome_frame/turndown_prompt/turndown_prompt.cc19
-rw-r--r--chrome_frame/turndown_prompt/turndown_prompt_window.cc90
-rw-r--r--chrome_frame/turndown_prompt/turndown_prompt_window.h13
7 files changed, 2 insertions, 188 deletions
diff --git a/chrome_frame/chrome_frame.gyp b/chrome_frame/chrome_frame.gyp
index 4d6dea7..2d8554f 100644
--- a/chrome_frame/chrome_frame.gyp
+++ b/chrome_frame/chrome_frame.gyp
@@ -769,8 +769,6 @@
'registry_list_preferences_holder.h',
'stream_impl.cc',
'stream_impl.h',
- 'turndown_prompt/reshow_state.cc',
- 'turndown_prompt/reshow_state.h',
'turndown_prompt/turndown_prompt.cc',
'turndown_prompt/turndown_prompt.h',
'turndown_prompt/turndown_prompt_content.cc',
diff --git a/chrome_frame/resources/chrome_frame_resources.grd b/chrome_frame/resources/chrome_frame_resources.grd
index 8bc5584..bf51a8f 100644
--- a/chrome_frame/resources/chrome_frame_resources.grd
+++ b/chrome_frame/resources/chrome_frame_resources.grd
@@ -39,7 +39,6 @@ for localizable strings
<if expr="not pp_ifdef('_google_chrome')">
<include name="IDI_CHROME_FRAME_ICON" file="../../chrome/app/theme/chromium/chromium.ico" type="ICON" />
</if>
- <include name="IDB_TURNDOWN_PROMPT_CLOSE_BUTTON" file="../../chrome/app/theme/default_100_percent/common/cf_close_strip.bmp" type="BITMAP" />
</includes>
</release>
</grit>
diff --git a/chrome_frame/turndown_prompt/reshow_state.cc b/chrome_frame/turndown_prompt/reshow_state.cc
deleted file mode 100644
index cf7e2f9..0000000
--- a/chrome_frame/turndown_prompt/reshow_state.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 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.
-
-#include "chrome_frame/turndown_prompt/reshow_state.h"
-
-#include "base/win/registry.h"
-#include "chrome_frame/utils.h"
-
-namespace {
-
-const wchar_t kTurndownPromptLastShown[] = L"TurndownPromptLastShown";
-
-}
-
-namespace turndown_prompt {
-
-ReshowState::ReshowState(const base::TimeDelta& reshow_delta)
- : reshow_delta_(reshow_delta) {
-}
-
-ReshowState::~ReshowState() {
-}
-
-bool ReshowState::HasReshowDeltaExpired(const base::Time& current_time) const {
- int64 last_shown = GetConfigInt64(0LL, kTurndownPromptLastShown);
- if (!last_shown)
- return true;
-
- base::Time last_shown_time(base::Time::FromInternalValue(last_shown));
-
- return current_time - last_shown_time >= reshow_delta_;
-}
-
-void ReshowState::MarkShown(const base::Time& last_shown_time) {
- SetConfigInt64(kTurndownPromptLastShown, last_shown_time.ToInternalValue());
-}
-
-} // namespace turndown_prompt
diff --git a/chrome_frame/turndown_prompt/reshow_state.h b/chrome_frame/turndown_prompt/reshow_state.h
deleted file mode 100644
index a3989a1..0000000
--- a/chrome_frame/turndown_prompt/reshow_state.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 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_FRAME_TURNDOWN_PROMPT_RESHOW_STATE_H_
-#define CHROME_FRAME_TURNDOWN_PROMPT_RESHOW_STATE_H_
-
-#include "base/time/time.h"
-
-namespace turndown_prompt {
-
-class ReshowState {
- public:
- explicit ReshowState(const base::TimeDelta& reshow_delta);
- ~ReshowState();
-
- bool HasReshowDeltaExpired(const base::Time& current_time) const;
- void MarkShown(const base::Time& last_shown_time);
-
- private:
- base::TimeDelta reshow_delta_;
-};
-
-} // namespace turndown_prompt
-
-#endif // CHROME_FRAME_TURNDOWN_PROMPT_RESHOW_STATE_H_
diff --git a/chrome_frame/turndown_prompt/turndown_prompt.cc b/chrome_frame/turndown_prompt/turndown_prompt.cc
index f3e9af7..40c16e5 100644
--- a/chrome_frame/turndown_prompt/turndown_prompt.cc
+++ b/chrome_frame/turndown_prompt/turndown_prompt.cc
@@ -26,7 +26,6 @@
#include "chrome_frame/ready_mode/internal/ready_mode_web_browser_adapter.h"
#include "chrome_frame/ready_mode/internal/url_launcher.h"
#include "chrome_frame/simple_resource_loader.h"
-#include "chrome_frame/turndown_prompt/reshow_state.h"
#include "chrome_frame/turndown_prompt/turndown_prompt_content.h"
#include "chrome_frame/utils.h"
#include "grit/chromium_strings.h"
@@ -34,9 +33,6 @@
namespace {
-// Time between showings of the turndown prompt.
-const int kTurndownPromptReshowDeltaMinutes = 60 * 24 * 1;
-
void OnUninstallClicked(UrlLauncher* url_launcher);
// Manages the Turndown UI in response to browsing ChromeFrame-rendered
@@ -52,8 +48,7 @@ class BrowserObserver : public ReadyModeWebBrowserAdapter::Observer {
virtual void OnRenderInHost(const string16& url);
private:
- // Shows the turndown prompt if it hasn't been seen since
- // kTurndownPromptReshowDeltaMinutes.
+ // Shows the turndown prompt.
void ShowPrompt();
void Hide();
// Returns a self-managed pointer that is not guaranteed to survive handling
@@ -122,13 +117,6 @@ void BrowserObserver::OnRenderInHost(const string16& url) {
}
void BrowserObserver::ShowPrompt() {
- turndown_prompt::ReshowState reshow_state(
- base::TimeDelta::FromMinutes(kTurndownPromptReshowDeltaMinutes));
-
- // Short-circuit if the prompt shouldn't be shown again yet.
- if (!reshow_state.HasReshowDeltaExpired(base::Time::Now()))
- return;
-
// This pointer is self-managed and not guaranteed to survive handling of
// Windows events. For safety's sake, retrieve this pointer for each use and
// do not store it for use outside of scope.
@@ -144,10 +132,7 @@ void BrowserObserver::ShowPrompt() {
base::Bind(&OnUninstallClicked,
base::Owned(new UrlLauncherImpl(web_browser_)))));
- if (infobar_manager->Show(infobar_content.release(), TOP_INFOBAR)) {
- // Update state in the registry that the prompt was shown.
- reshow_state.MarkShown(base::Time::Now());
- }
+ infobar_manager->Show(infobar_content.release(), TOP_INFOBAR);
}
}
diff --git a/chrome_frame/turndown_prompt/turndown_prompt_window.cc b/chrome_frame/turndown_prompt/turndown_prompt_window.cc
index 17321e0..d2174da 100644
--- a/chrome_frame/turndown_prompt/turndown_prompt_window.cc
+++ b/chrome_frame/turndown_prompt/turndown_prompt_window.cc
@@ -13,7 +13,6 @@
#include "chrome_frame/simple_resource_loader.h"
#include "chrome_frame/utils.h"
#include "grit/chrome_frame_dialogs.h"
-#include "grit/chrome_frame_resources.h"
#include "grit/chromium_strings.h"
// atlctrlx.h requires 'min' and 'max' macros, the definition of which conflicts
@@ -23,34 +22,6 @@
#include <minmax.h> // NOLINT
#include <atlctrlx.h> // NOLINT
-namespace {
-const uint32 kBitmapImageSize = 18;
-} // namespace
-
-// WTL's CBitmapButton's drawing code is horribly broken when using transparent
-// images (specifically, it doesn't clear the background between redraws).
-// Fix it here.
-class CFBitmapButton: public CBitmapButtonImpl<CFBitmapButton>
-{
- public:
- DECLARE_WND_SUPERCLASS(_T("WTL_BitmapButton"), GetWndClassName())
-
- CFBitmapButton()
- : CBitmapButtonImpl<CFBitmapButton>(BMPBTN_AUTOSIZE | BMPBTN_HOVER,
- NULL) {}
-
- // "Overridden" from CBitmapButtonImpl via template hackery. See
- // CBitmapButtonImpl::OnPaint() in atlctrlx.h for details.
- void DoPaint(CDCHandle dc) {
- RECT rc = {0};
- GetClientRect(&rc);
- dc.FillRect(&rc, reinterpret_cast<HBRUSH>(COLOR_BTNFACE + 1));
-
- // Call original implementation.
- CBitmapButtonImpl<CFBitmapButton>::DoPaint(dc);
- }
-};
-
// static
base::WeakPtr<TurndownPromptWindow> TurndownPromptWindow::CreateInstance(
InfobarContent::Frame* frame,
@@ -78,8 +49,6 @@ base::WeakPtr<TurndownPromptWindow> TurndownPromptWindow::CreateInstance(
instance->link_->SetHyperLinkExtendedStyle(HLINK_NOTIFYBUTTON,
HLINK_NOTIFYBUTTON);
- SetupBitmapButton(instance.get());
-
// Substitute the proper text given the current IE version.
CWindow text = instance->GetDlgItem(IDC_TD_PROMPT_MESSAGE);
string16 prompt_text(GetPromptText());
@@ -101,62 +70,11 @@ TurndownPromptWindow::TurndownPromptWindow(
TurndownPromptWindow::~TurndownPromptWindow() {}
-// static
-void TurndownPromptWindow::SetupBitmapButton(TurndownPromptWindow* instance) {
- DCHECK(instance);
- CWindow close_window = instance->GetDlgItem(IDDISMISS);
- instance->close_button_.reset(new CFBitmapButton());
-
- // Set the resource instance to the current dll which contains the bitmap.
- HINSTANCE old_res_module = _AtlBaseModule.GetResourceInstance();
- HINSTANCE this_module = _AtlBaseModule.GetModuleInstance();
- _AtlBaseModule.SetResourceInstance(this_module);
-
- HBITMAP close_bitmap = static_cast<HBITMAP>(
- LoadImage(this_module, MAKEINTRESOURCE(IDB_TURNDOWN_PROMPT_CLOSE_BUTTON),
- IMAGE_BITMAP, 0, 0, 0));
-
- // Restore the module's resource instance.
- _AtlBaseModule.SetResourceInstance(old_res_module);
-
- // Create the image list with the appropriate size and colour mask.
- instance->close_button_->m_ImageList.Create(kBitmapImageSize,
- kBitmapImageSize,
- ILC_COLOR8 | ILC_MASK, 4, 0);
- instance->close_button_->m_ImageList.Add(close_bitmap, RGB(255, 0, 255));
- instance->close_button_->m_ImageList.SetBkColor(CLR_NONE);
-
- // Free up the original bitmap.
- DeleteObject(close_bitmap);
-
- // Configure the button states and initialize the button.
- instance->close_button_->SetImages(0, 1, 2, 3);
- instance->close_button_->SubclassWindow(close_window);
-
- // The CDialogResize() implementation incorrectly captures the size
- // of the bitmap image button. Reset it here to ensure that resizing works
- // as desired.
-
- // Find the resize data. The parameters here must match the resize map in
- // turndown_prompt_window.h.
- _AtlDlgResizeData resize_params = { IDDISMISS, DLSZ_CENTER_Y | DLSZ_MOVE_X };
- int resize_index = instance->m_arrData.Find(resize_params);
- DCHECK(resize_index > -1 && resize_index < instance->m_arrData.GetSize());
-
- // Fiddle CDialogResize's internal data to fix up the size for the image
- // control.
- _AtlDlgResizeData& resize_data = instance->m_arrData[resize_index];
- resize_data.m_rect.right = resize_data.m_rect.left + kBitmapImageSize;
- resize_data.m_rect.top = 0;
- resize_data.m_rect.bottom = kBitmapImageSize;
-}
-
void TurndownPromptWindow::OnFinalMessage(HWND) {
delete this;
}
void TurndownPromptWindow::OnDestroy() {
- close_button_->m_ImageList.Destroy();
frame_ = NULL;
}
@@ -183,14 +101,6 @@ LRESULT TurndownPromptWindow::OnUninstall(WORD /*wNotifyCode*/,
return 0;
}
-LRESULT TurndownPromptWindow::OnDismiss(WORD /*wNotifyCode*/,
- WORD /*wID*/,
- HWND /*hWndCtl*/,
- BOOL& /*bHandled*/) {
- frame_->CloseInfobar();
- return 0;
-}
-
// static
string16 TurndownPromptWindow::GetPromptText() {
IEVersion ie_version = GetIEVersion();
diff --git a/chrome_frame/turndown_prompt/turndown_prompt_window.h b/chrome_frame/turndown_prompt/turndown_prompt_window.h
index 342e38a..61614c7 100644
--- a/chrome_frame/turndown_prompt/turndown_prompt_window.h
+++ b/chrome_frame/turndown_prompt/turndown_prompt_window.h
@@ -28,11 +28,8 @@ class UrlLauncher;
namespace WTL {
class CHyperLink;
-class CBitmapButton;
} // namespace WTL
-class CFBitmapButton;
-
// Implements a dialog with text and buttons notifying the user that Chrome
// Frame is being turned down, offering them a link to learn more about moving
// to a modern browser.
@@ -64,12 +61,10 @@ class TurndownPromptWindow
MSG_WM_INITDIALOG(OnInitDialog)
NOTIFY_HANDLER(IDC_TD_PROMPT_LINK, NM_CLICK, OnLearnMore)
COMMAND_HANDLER(IDUNINSTALL, BN_CLICKED, OnUninstall)
- COMMAND_HANDLER(IDDISMISS, BN_CLICKED, OnDismiss)
CHAIN_MSG_MAP(CDialogResize<TurndownPromptWindow>)
END_MSG_MAP()
BEGIN_DLGRESIZE_MAP(InfobarWindow)
- DLGRESIZE_CONTROL(IDDISMISS, DLSZ_CENTER_Y | DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDUNINSTALL, DLSZ_CENTER_Y | DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_TD_PROMPT_LINK, DLSZ_CENTER_Y | DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_TD_PROMPT_MESSAGE, DLSZ_SIZE_Y | DLSZ_SIZE_X)
@@ -86,9 +81,6 @@ class TurndownPromptWindow
// The TurndownPromptWindow manages its own destruction.
virtual ~TurndownPromptWindow();
- // Performs the necessary configuration to initialize a bitmap button.
- static void SetupBitmapButton(TurndownPromptWindow* window);
-
// Event handlers.
void OnDestroy();
BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam);
@@ -97,17 +89,12 @@ class TurndownPromptWindow
WORD wID,
HWND hWndCtl,
BOOL& bHandled);
- LRESULT OnDismiss(WORD wNotifyCode,
- WORD wID,
- HWND hWndCtl,
- BOOL& bHandled);
// Returns the prompt text for the current version of IE.
static string16 GetPromptText();
InfobarContent::Frame* frame_; // Not owned by this instance
scoped_ptr<WTL::CHyperLink> link_;
- scoped_ptr<CFBitmapButton> close_button_;
scoped_ptr<UrlLauncher> url_launcher_;
base::Closure uninstall_closure_;