toolkit/mozapps/update/updater/progressui_gonk.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  * vim: sw=2 ts=8 et :
     3  */
     4 /* This Source Code Form is subject to the terms of the Mozilla Public
     5  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     6  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     8 #include <assert.h>
     9 #include <stdio.h>
    11 #include <string>
    13 #include "android/log.h"
    15 #include "progressui.h"
    17 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoUpdater" , ## args)
    19 using namespace std;
    21 int InitProgressUI(int *argc, char ***argv)
    22 {
    23   return 0;
    24 }
    26 int ShowProgressUI()
    27 {
    28   LOG("Starting to apply update ...\n");
    29   return 0;
    30 }
    32 void QuitProgressUI()
    33 {
    34   LOG("Finished applying update\n");
    35 }
    37 void UpdateProgressUI(float progress)
    38 {
    39   assert(0.0f <= progress && progress <= 100.0f);
    41   static const size_t kProgressBarLength = 50;
    42   static size_t sLastNumBars;
    43   size_t numBars = size_t(float(kProgressBarLength) * progress / 100.0f);
    44   if (numBars == sLastNumBars) {
    45     return;
    46   }
    47   sLastNumBars = numBars;
    49   size_t numSpaces = kProgressBarLength - numBars;
    50   string bars(numBars, '=');
    51   string spaces(numSpaces, ' ');
    52   LOG("Progress [ %s%s ]\n", bars.c_str(), spaces.c_str());
    53 }

mercurial